feat: inject pending questions into env_text — active notification from role agents to cockpit
This commit is contained in:
parent
2544081529
commit
22f76e71b9
@ -34,7 +34,7 @@ AGENT_PROMPT = """你是开发产线驾驶舱 Agent。用工具获取数据,
|
||||
- 提交任务:先确保在正确项目,再 create_task
|
||||
- 诊断项目:diagnose_project 找出卡点/失败任务/待回答问题
|
||||
- 启动Agent:任务提交后调 start_agents 让角色Agent执行
|
||||
- 回答问题:list_questions 看问题 → answer_question 回答
|
||||
- 回答问题:list_questions 看问题 → answer_question 回答。待回答问题在环境信息中已列出,主动提示用户
|
||||
- clone_repo 用于克隆 git 仓库到工作空间
|
||||
- run_command 用于在工作空间中执行 shell 命令
|
||||
|
||||
@ -491,7 +491,13 @@ if action == 'send_message':
|
||||
return
|
||||
|
||||
repos_str = ', '.join([r['n'] for r in ctx['repos']]) or '无'
|
||||
env_text = f"【当前项目: {ctx['pname'] or '未选择'}】— 所有操作在当前项目内完成\n工作空间: {ctx['ws'] or '未设置'} | 仓库: {repos_str}"
|
||||
# Check for pending questions from role agents
|
||||
pending_qs = []
|
||||
if ctx['pid']:
|
||||
qs = await sor.sqlExe("SELECT id,question,task_id FROM pipeline_agent_questions WHERE tenant_id=${p}$ AND status='pending' ORDER BY created_at ASC LIMIT 5",{"p":ctx['pid']})
|
||||
pending_qs = [f" [{getattr(q,'id','')[:8]}] {getattr(q,'question','')[:100]}" for q in (qs or [])]
|
||||
qinfo = '\n'.join(pending_qs) if pending_qs else '无'
|
||||
env_text = f"【当前项目: {ctx['pname'] or '未选择'}】— 所有操作在当前项目内完成\n工作空间: {ctx['ws'] or '未设置'} | 仓库: {repos_str}\n待回答问题: {qinfo}"
|
||||
system = AGENT_PROMPT.replace('__TOOLS__',TOOLS_TEXT).replace('__ENV__',env_text)
|
||||
debug(f"SYSTEM PROMPT env: {env_text}")
|
||||
msgs = [{"role":"system","content":system}]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user