From 22f76e71b9062e90848f2907fcdaea8386b329e5 Mon Sep 17 00:00:00 2001 From: ymq Date: Mon, 10 Aug 2026 00:15:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20inject=20pending=20questions=20into=20e?= =?UTF-8?q?nv=5Ftext=20=E2=80=94=20active=20notification=20from=20role=20a?= =?UTF-8?q?gents=20to=20cockpit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/cockpit_chat.dspy | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wwwroot/api/cockpit_chat.dspy b/wwwroot/api/cockpit_chat.dspy index 5e74bc1..497a248 100644 --- a/wwwroot/api/cockpit_chat.dspy +++ b/wwwroot/api/cockpit_chat.dspy @@ -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}]