auto-sync: 2026-05-30 10:25:32

This commit is contained in:
cfdaily
2026-05-30 10:25:32 +08:00
parent a606a5b417
commit b07a87f667
+25 -22
View File
@@ -743,12 +743,27 @@ Parent Task ID: {parent_task.id}
def _build_mention_prompt(self, agent_id: str, task: Any,
mention_lines: List[str],
project_id: str) -> str:
"""构建 @mention 通知 prompt"""
mentions_text = "\n".join(mention_lines[:10])
"""#03: @mention prompt(身份注入)"""
api_host = getattr(self.spawner, 'api_host', '127.0.0.1') if self.spawner else '127.0.0.1'
api_port = getattr(self.spawner, 'api_port', 8083) if self.spawner else 8083
api_base = f"http://{api_host}:{api_port}/api"
return f"""你在黑板上被 @ 了,请查看并回应。
# 获取 Agent 专长
caps = "通用"
try:
if self.dispatcher and self.dispatcher.router:
profile = self.dispatcher.router.agent_profiles.get(agent_id)
if profile and profile.capabilities_zh:
caps = ", ".join(profile.capabilities_zh)
except Exception:
pass
mentions_text = "\n".join(mention_lines[:10])
return f"""你在黑板上被 @ 了。
## 你的身份
你是 {agent_id},专长: {caps}
## 相关讨论
{mentions_text}
@@ -758,26 +773,14 @@ Parent Task ID: {parent_task.id}
- 任务: {task.title}
- 描述: {task.description or ''}
## 操作
1. 先读黑板了解上下文:
```bash
curl http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task.id}?expand=all
```
## 你能做什么
- 读完整上下文: GET {api_base}/projects/{project_id}/tasks/{task.id}?expand=all
- 回应: POST {api_base}/projects/{project_id}/tasks/{task.id}/comments
- 如果讨论收敛到可执行任务,可以创建 sub task
2. 在黑板上回应(写 comment):
```bash
curl -X POST http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task.id}/comments \
-H 'Content-Type: application/json' \
-d '{{"author": "{agent_id}", "body": "你的回应"}}'
```
3. 如果讨论收敛到可执行的任务,可以创建 sub task
4. 完成后标记 done
```bash
curl -X POST http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task.id}/status \
-H 'Content-Type: application/json' \
-d '{{"status": "done", "agent": "{agent_id}"}}'
```
## 约束
- 只回应与你专长相关的内容
- 禁止使用 sessions_send 直接发消息
"""
def _advance_dependencies(self, db_path: Path) -> List[str]: