更新 API 路由,添加获取所有代理、心跳、锁和会议的端点;修改会议队列和前端请求处理;新增前端完整测试脚本。
This commit is contained in:
@@ -33,22 +33,37 @@ async def execute_task(request: TaskRequest):
|
||||
@router.get("/status")
|
||||
async def get_all_status():
|
||||
"""获取所有 Agent 状态"""
|
||||
return {
|
||||
"agents": [
|
||||
{
|
||||
"agent_id": "claude-001",
|
||||
"status": "working",
|
||||
"current_task": "开发功能",
|
||||
"progress": 75
|
||||
from ..services.agent_registry import get_agent_registry
|
||||
from ..services.heartbeat import get_heartbeat_service
|
||||
|
||||
registry = get_agent_registry()
|
||||
heartbeat_service = get_heartbeat_service()
|
||||
|
||||
# 获取所有已注册的 Agent
|
||||
all_agents = await registry.list_agents()
|
||||
agent_map = {a.agent_id: a for a in all_agents}
|
||||
|
||||
# 获取所有心跳
|
||||
heartbeats_data = await heartbeat_service.get_all_heartbeats()
|
||||
|
||||
result = []
|
||||
for agent_id, agent in agent_map.items():
|
||||
heartbeat = heartbeats_data.get(agent_id)
|
||||
result.append({
|
||||
"agent_id": agent_id,
|
||||
"info": {
|
||||
"name": agent.name,
|
||||
"role": agent.role,
|
||||
"model": agent.model
|
||||
},
|
||||
{
|
||||
"agent_id": "kimi-001",
|
||||
"status": "idle",
|
||||
"current_task": "",
|
||||
"progress": 0
|
||||
"heartbeat": {
|
||||
"status": heartbeat.status if heartbeat else "offline",
|
||||
"current_task": heartbeat.current_task if heartbeat else "",
|
||||
"progress": heartbeat.progress if heartbeat else 0
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
return {"agents": result}
|
||||
|
||||
|
||||
@router.post("/parse-task")
|
||||
|
||||
Reference in New Issue
Block a user