forked from xiaohei/taiji-AI-PAD
3.2 KiB
3.2 KiB
Agent Manager 响应格式更新 - 快速参考
✅ 已完成的更新
1. 数据模型
- ✅
agent_manager_client.py::TemplateInfo- 添加display_name,description,category字段 - ✅
schemas.py::TemplateInfo- 添加displayName,description,category字段
2. 接口解析
- ✅
list_templates()- 解析新字段 - ✅
list_platform_templates()- 解析新字段 - ✅
list_custom_templates()- 解析新字段
3. 路由层优先级逻辑
优先级: DB配置 > Agent Manager返回 > 硬编码默认值
- ✅
admin.py::_get_platform_templates_from_agent_manager() - ✅
channel.py::_get_platform_templates_from_agent_manager() - ✅
channel.py::_get_custom_templates_from_agent_manager() - ✅
platform_agent_quota.py::get_available_platform_agents() - ✅
agents.py::list_templates() - ✅
agents.py::list_platform_templates() - ✅
agents.py::list_custom_templates()
4. 向后兼容
- ✅ 保留
TEMPLATE_DISPLAY_INFO硬编码默认值 - ✅ 降级逻辑:当 Agent Manager 未返回时使用默认值
📊 Agent Manager 预期返回格式
{
"templates": [
{
"template": "echo_agent", // 必需
"displayName": "Echo 测试服务", // 新增 ✨
"description": "简单的测试服务", // 新增 ✨
"category": "testing", // 新增 ✨
"port": 8000, // 可选
"env_info": {} // 可选
}
]
}
🎯 各端展示逻辑
管理端 (Admin)
优先级: DB配置 > Agent Manager > 硬编码
渠道端 (Channel)
优先级: DB配置 > Agent Manager > 硬编码
用户端 (User)
优先级: Agent Manager > 硬编码
✅ 验证清单
Agent Manager 端 (需要确认)
GET /templates/platform返回displayNameGET /templates/platform返回descriptionGET /templates/platform返回categoryGET /templates/custom返回新字段
MCP-Server 端 (已完成)
- 数据模型包含新字段
- 接口解析新字段
- 路由优先使用 Agent Manager 返回值
- 保持向后兼容性
- 代码编译无错误
前端端 (需要测试)
- 管理端正确显示 displayName
- 渠道端正确显示 displayName
- 用户端正确显示 displayName
🚀 测试命令
# 1. 测试 Agent Manager 接口
curl http://agent-manager:8000/templates/platform
# 2. 测试 MCP-Server 管理员接口
curl http://localhost:8002/api/admin/platform-agents/templates \
-H "Authorization: Bearer YOUR_TOKEN"
# 3. 测试 MCP-Server 渠道接口
curl http://localhost:8002/api/channel/available-platform-agents \
-H "Authorization: Bearer YOUR_TOKEN"
📝 重要说明
- Agent Manager 必须先更新 - 返回新字段后 MCP-Server 才会使用
- 降级逻辑自动生效 - 如果 Agent Manager 未返回,自动使用默认值
- 数据库配置优先 - 管理员可以在数据库中覆盖任何显示名称