Skip to content

API 端点

FastAPI 路由表。所有端点(除 /api/auth/login/api/auth/verify)需要 Authorization: Bearer <JWT> 头。

认证

方法路径说明
POST/api/auth/login登录,返回 JWT token
GET/api/auth/verify验证 token 有效性

Agent 管理 (cococat/routes/agents.py)

方法路径说明
GET/api/agents列出所有 agent 及状态
GET/api/agents/{id}获取单个 agent 详情
POST/api/agents创建新 agent
PUT/api/agents/{id}更新 agent
DELETE/api/agents/{id}删除 agent
GET/api/agents/{id}/profile获取 agent 个性配置
PUT/api/agents/{id}/profile更新 agent 个性
GET/api/agents/{id}/skills列出 agent 技能
GET/api/agents/{id}/memory读取 agent 记忆(MEMORY.md)
GET/api/agents/{id}/history读取 agent 历史(history.jsonl)
GET/api/agents/{id}/display获取显示配置
PUT/api/agents/{id}/display更新显示配置

场景管理 (cococat/routes/scenes.py)

方法路径说明
GET/api/scenes列出所有场景
POST/api/scenes创建场景
DELETE/api/scenes/{id}删除场景
GET/api/scenes/{id}/context获取场景 CONTEXT.md
PUT/api/scenes/{id}/context更新场景 CONTEXT.md
GET/api/scenes/{id}/kbs获取挂载的知识库
POST/api/scenes/{id}/kbs挂载知识库
DELETE/api/scenes/{id}/kbs/{kb_id}卸载知识库
GET/api/scenes/{id}/roster获取场景成员列表
POST/api/scenes/{id}/roster添加成员
DELETE/api/scenes/{id}/roster/{agent_id}移除成员
GET/api/scenes/{id}/skills获取场景技能
PUT/api/scenes/{id}/skills更新场景技能
POST/api/scenes/{id}/chat场景对话(外部入口)
GET/api/scenes/{id}/users/{uid}/history获取用户对话历史

知识库 (cococat/routes/knowledge.py)

方法路径说明
GET/api/knowledge列出所有知识库
POST/api/knowledge创建知识库
DELETE/api/knowledge/{id}删除知识库
GET/api/knowledge/{id}/wiki列出 Wiki 页面
GET/api/knowledge/{id}/wiki/{slug}获取 Wiki 页面内容
POST/api/knowledge/{id}/wiki创建 Wiki 页面
PUT/api/knowledge/{id}/wiki/{slug}更新 Wiki 页面
DELETE/api/knowledge/{id}/wiki/{slug}删除 Wiki 页面
GET/api/knowledge/{id}/search搜索知识库

聊天群组 (cococat/routes/chat_groups.py)

方法路径说明
GET/api/chat读取聊天记录
GET/api/chat/groups列出群组
POST/api/chat/groups创建群组
DELETE/api/chat/groups/{id}删除群组
GET/api/chat/groups/{id}/messages获取群消息
POST/api/chat/groups/{id}/messages发送群消息

邮箱 (cococat/routes/mailbox.py)

方法路径说明
GET/api/mailbox/{agent_id}查看邮箱(收件箱)
POST/api/mailbox/send发送消息
PUT/api/mailbox/{agent_id}/read/{idx}标记已读

Hiring (cococat/app.py)

方法路径说明
GET/api/hiring/pending列出待审批的 hire 请求
POST/api/hiring/pending/{id}/approve批准 hire
POST/api/hiring/pending/{id}/reject拒绝 hire

定时任务 (cococat/routes/schedule.py)

方法路径说明
GET/api/schedule列出定时任务
POST/api/schedule创建定时任务
PUT/api/schedule/{id}更新定时任务
DELETE/api/schedule/{id}删除定时任务

状态 (cococat/routes/status.py)

方法路径说明
GET/api/agents/status所有 agent 运行状态
GET/api/status系统总体状态
GET/api/usageToken 用量统计

协作 (cococat/routes/collaboration.py)

方法路径说明
GET/api/collaboration/graph获取 agent 协作关系图

入口 (cococat/routes/entries.py)

方法路径说明
GET/api/entries列出所有频道入口配置
POST/api/entries创建频道入口
DELETE/api/entries/{id}删除频道入口

外部通道

方法路径说明
GET/POST/api/channels/wechat/{scene_id}微信公众号 webhook
POST/api/channels/webhook/{type}/{id}通用 webhook 入口

WebSocket

路径参数说明
/ws?token=实时推送(心跳、事件)

基于 MIT 协议开源