diff --git a/backend/python/app/api/chat.py b/backend/python/app/api/chat.py index baa2965..57934e7 100644 --- a/backend/python/app/api/chat.py +++ b/backend/python/app/api/chat.py @@ -875,6 +875,8 @@ async def send_message( ai_content = "" ai_model = None + skills = [] # 初始化避免UnboundLocalError + agents = [] # 初始化避免UnboundLocalError if model_id: ai_model = db.query(AIModel).filter(AIModel.id == model_id).first() diff --git a/frontend/src/pages/front/ChatPage.tsx b/frontend/src/pages/front/ChatPage.tsx index b2c0e5b..da45cf0 100644 --- a/frontend/src/pages/front/ChatPage.tsx +++ b/frontend/src/pages/front/ChatPage.tsx @@ -387,16 +387,16 @@ const ChatPage: React.FC = () => { let apps: any[] = []; if (Array.isArray(data)) apps = data; else if (data?.items) apps = data.items; - // 过滤已卸载和未安装的agent - setAgents(apps.filter((a: any) => a.installed !== false && a.status !== 'removed')); + // 显示所有已发布的Agent(不需要安装即可在聊天中使用) + setAgents(apps.filter((a: any) => a.status === 'published' || a.status === 'active' || !a.status)); }).catch(() => {}); marketAPI.getApps({ type: 'skill' }).then((res: any) => { const data = res?.data !== undefined ? res.data : res; let apps: any[] = []; if (Array.isArray(data)) apps = data; else if (data?.items) apps = data.items; - // 过滤已卸载和未安装的skill - setSkills(apps.filter((a: any) => a.installed !== false && a.status !== 'removed')); + // 显示所有已发布的技能(不需要安装即可在聊天中使用) + setSkills(apps.filter((a: any) => a.status === 'published' || a.status === 'active' || !a.status)); }).catch(() => {}); }, []);