JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
feat(skills): 面板单次 RPC 拉取列表与已安装插件
lairuofei15105777661e
diff --git a/jiuwenclaw/agentserver/skill_manager.py b/jiuwenclaw/agentserver/skill_manager.pyindex 23f1e391f9..3a6f579956 100644--- a/jiuwenclaw/agentserver/skill_manager.py+++ b/jiuwenclaw/agentserver/skill_manager.py@@ -52,13 +52,20 @@ class SkillManager:params:refresh_marketplaces: bool (可选, 默认 False)为 True 时,先对已配置 marketplace 执行 clone/pull,再扫描列表。+ with_installed: bool (可选, 默认 False)+ 为 True 时,同一次响应中附带 plugins(与 skills.installed 一致),+ 避免网关串行处理两次 RPC 导致列表刷新超时或排队过久。"""refresh_marketplaces = bool(params.get("refresh_marketplaces", False))if refresh_marketplaces:await self._sync_marketplace_repos()local = self._scan_local_skills()marketplace = self._scan_marketplace_skills()- return {"skills": local + marketplace}+ out: dict[str, Any] = {"skills": local + marketplace}+ if bool(params.get("with_installed", False)):+ installed = await self.handle_skills_installed(params)+ out["plugins"] = installed.get("plugins") or []+ return outasync def handle_skills_installed(self, params: dict) -> dict:"""返回已安装的 marketplace 插件列表.diff --git a/jiuwenclaw/web/src/components/SkillPanel/index.tsx b/jiuwenclaw/web/src/components/SkillPanel/index.tsxindex 7e8f8480dd..a6cd02de71 100644--- a/jiuwenclaw/web/src/components/SkillPanel/index.tsx+++ b/jiuwenclaw/web/src/components/SkillPanel/index.tsx@@ -9,6 +9,10 @@ import { webRequest } from "../../services/webClient";import { SourceManagerModal } from "../../features/SourceManagerModal";import { SkillNetSearchModal } from "../../features/SkillNetSearchModal";+/** 刷新会 git pull marketplace,略放宽;普通进页单次 RPC 一般很快。 */+const SKILLS_FETCH_TIMEOUT_REFRESH_MS = 60_000;+const SKILLS_FETCH_TIMEOUT_NORMAL_MS = 30_000;+type SkillItem = {name: string;description: string;@@ -135,17 +139,23 @@ export function SkillPanel({ sessionId }: SkillPanelProps) {const fetchSkills = useCallback(async (refreshMarketplaces = false) => {setListState("loading");try {- const [skillsData, pluginsData] = await Promise.all([- webRequest<{ skills?: SkillItem[] }>(- "skills.list",- withSession(- refreshMarketplaces ? { refresh_marketplaces: true } : undefined- )- ),- webRequest<{ plugins?: InstalledPluginItem[] }>("skills.installed", withSession()),- ]);- setSkills(skillsData.skills || []);- setPlugins(pluginsData.plugins || []);+ const data = await webRequest<{+ skills?: SkillItem[];+ plugins?: InstalledPluginItem[];+ }>(+ "skills.list",+ withSession({+ with_installed: true,+ ...(refreshMarketplaces ? { refresh_marketplaces: true } : {}),+ }),+ {+ timeoutMs: refreshMarketplaces+ ? SKILLS_FETCH_TIMEOUT_REFRESH_MS+ : SKILLS_FETCH_TIMEOUT_NORMAL_MS,+ }+ );+ setSkills(data.skills || []);+ setPlugins(data.plugins || []);setListState("success");fetchMarketplaces();