From f29521d327b7e1b82fbc3d0108f16dab49fe9596 Mon Sep 17 00:00:00 2001 From: hjjjj <1311711287@qq.com> Date: Tue, 27 Jan 2026 10:51:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/settings.local.json | 3 ++- backend/app/config.py | 2 +- frontend/src/pages/SkillManagement.tsx | 29 +++++++++++++++++++++----- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index eb556ed..11ac2dc 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -13,7 +13,8 @@ "Bash(node:*)", "Bash(netstat:*)", "Bash(tail:*)", - "Bash(tasklist:*)" + "Bash(tasklist:*)", + "Bash(taskkill:*)" ] } } diff --git a/backend/app/config.py b/backend/app/config.py index 5f97717..013b771 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -71,7 +71,7 @@ class Settings(BaseSettings): # ============================================ # Skill 存储配置 # ============================================ - skills_dir: str = "./skills_storage" + skills_dir: str = os.path.join(os.path.dirname(os.path.dirname(__file__)), "skills_storage") @property def cors_origins(self) -> List[str]: diff --git a/frontend/src/pages/SkillManagement.tsx b/frontend/src/pages/SkillManagement.tsx index 07fcceb..4029d17 100644 --- a/frontend/src/pages/SkillManagement.tsx +++ b/frontend/src/pages/SkillManagement.tsx @@ -125,12 +125,31 @@ export const SkillManagement = () => { useEffect(() => { fetchSkills() - // 轮询技能生成任务 - const interval = setInterval(async () => { - await fetchSkillGenerationTasks() - }, 3000) // 每3秒检查一次 + // 轮询技能生成任务 - 使用递归 setTimeout 而不是 setInterval + // 这样可以确保前一个请求完成后才开始下一个请求 + let isMounted = true - return () => clearInterval(interval) + const pollTasks = async () => { + if (!isMounted) return + + try { + await fetchSkillGenerationTasks() + } catch (error) { + console.error('Error polling tasks:', error) + } + + // 等待 3 秒后再次轮询 + if (isMounted) { + setTimeout(pollTasks, 3000) + } + } + + // 启动轮询 + pollTasks() + + return () => { + isMounted = false + } }, []) // 获取技能生成任务