添加全局协作规约功能

新功能:
- 新增 global_collaboration_rules 表
- POST /api/rules/global - 设置全局规约
- GET /api/rules/global - 获取全局规约
- 智能体领取任务时同时收到全局规约和项目规约

规约层级:
1. 全局规约 - 适用于所有项目和智能体
2. 项目规约 - 仅适用于特定项目

智能体领取任务时的响应示例:
{
  "collaboration_rules": {
    "global_rules": "全局规约内容",
    "project_rules": "项目规约内容"
  }
}
This commit is contained in:
work-1
2026-02-15 21:06:22 +08:00
parent a32ceb6d8e
commit 6134a443a8
2 changed files with 107 additions and 12 deletions
+32 -4
View File
@@ -63,6 +63,31 @@ Content-Type: application/json
### 协作规约
#### 设置全局协作规约
```http
POST /api/rules/global
Content-Type: application/json
{
"content": "# \n\n...",
"created_by": "human"
}
```
#### 获取全局协作规约
```http
GET /api/rules/global
:
{
"id": "xxx",
"content": "Markdown",
"created_by": "human",
"created_at": 1234567890,
"updated_at": 1234567890
}
```
#### 设置项目协作规约
```http
POST /api/projects/:projectId/rules
@@ -155,7 +180,7 @@ GET /api/tasks/:id
}
```
#### 领取任务(智能体会收到协作规约)
#### 领取任务(智能体会同时收到全局规约和项目规约)
```http
POST /api/tasks/:id/claim
Content-Type: application/json
@@ -164,11 +189,14 @@ Content-Type: application/json
"agent_id": "ID"
}
:
:
{
"message": "",
"collaboration_rules": "",
"notice": " "
"collaboration_rules": {
"global_rules": "",
"project_rules": ""
},
"notice": " "
}
```