修改页面加载问题

This commit is contained in:
hjjjj 2026-01-27 10:51:47 +08:00
parent d72991aa95
commit f29521d327
3 changed files with 27 additions and 7 deletions

View File

@ -13,7 +13,8 @@
"Bash(node:*)", "Bash(node:*)",
"Bash(netstat:*)", "Bash(netstat:*)",
"Bash(tail:*)", "Bash(tail:*)",
"Bash(tasklist:*)" "Bash(tasklist:*)",
"Bash(taskkill:*)"
] ]
} }
} }

View File

@ -71,7 +71,7 @@ class Settings(BaseSettings):
# ============================================ # ============================================
# Skill 存储配置 # Skill 存储配置
# ============================================ # ============================================
skills_dir: str = "./skills_storage" skills_dir: str = os.path.join(os.path.dirname(os.path.dirname(__file__)), "skills_storage")
@property @property
def cors_origins(self) -> List[str]: def cors_origins(self) -> List[str]:

View File

@ -125,12 +125,31 @@ export const SkillManagement = () => {
useEffect(() => { useEffect(() => {
fetchSkills() fetchSkills()
// 轮询技能生成任务 // 轮询技能生成任务 - 使用递归 setTimeout 而不是 setInterval
const interval = setInterval(async () => { // 这样可以确保前一个请求完成后才开始下一个请求
await fetchSkillGenerationTasks() let isMounted = true
}, 3000) // 每3秒检查一次
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
}
}, []) }, [])
// 获取技能生成任务 // 获取技能生成任务