auto-sync: 2026-05-30 10:25:32
This commit is contained in:
+25
-22
@@ -743,12 +743,27 @@ Parent Task ID: {parent_task.id}
|
|||||||
def _build_mention_prompt(self, agent_id: str, task: Any,
|
def _build_mention_prompt(self, agent_id: str, task: Any,
|
||||||
mention_lines: List[str],
|
mention_lines: List[str],
|
||||||
project_id: str) -> str:
|
project_id: str) -> str:
|
||||||
"""构建 @mention 通知 prompt"""
|
"""#03: @mention prompt(身份注入)"""
|
||||||
mentions_text = "\n".join(mention_lines[:10])
|
|
||||||
api_host = getattr(self.spawner, 'api_host', '127.0.0.1') if self.spawner else '127.0.0.1'
|
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_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}
|
{mentions_text}
|
||||||
@@ -758,26 +773,14 @@ Parent Task ID: {parent_task.id}
|
|||||||
- 任务: {task.title}
|
- 任务: {task.title}
|
||||||
- 描述: {task.description or '无'}
|
- 描述: {task.description or '无'}
|
||||||
|
|
||||||
## 操作
|
## 你能做什么
|
||||||
1. 先读黑板了解上下文:
|
- 读完整上下文: GET {api_base}/projects/{project_id}/tasks/{task.id}?expand=all
|
||||||
```bash
|
- 回应: POST {api_base}/projects/{project_id}/tasks/{task.id}/comments
|
||||||
curl http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task.id}?expand=all
|
- 如果讨论收敛到可执行任务,可以创建 sub task
|
||||||
```
|
|
||||||
|
|
||||||
2. 在黑板上回应(写 comment):
|
## 约束
|
||||||
```bash
|
- 只回应与你专长相关的内容
|
||||||
curl -X POST http://{api_host}:{api_port}/api/projects/{project_id}/tasks/{task.id}/comments \
|
- 禁止使用 sessions_send 直接发消息
|
||||||
-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}"}}'
|
|
||||||
```
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _advance_dependencies(self, db_path: Path) -> List[str]:
|
def _advance_dependencies(self, db_path: Path) -> List[str]:
|
||||||
|
|||||||
Reference in New Issue
Block a user