From 13b0aa5de558cad0846a7ee7acebd3ff0da04a47 Mon Sep 17 00:00:00 2001 From: ymq Date: Sat, 15 Aug 2026 00:27:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20cockpit=20v1=20diagnose=5Fproject=20?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E4=B8=AD=E4=BB=BB=E5=8A=A1=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=20claimed=5Fby+=E5=BF=83=E8=B7=B3=E9=99=88=E6=97=A7=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/cockpit_chat.dspy | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wwwroot/api/cockpit_chat.dspy b/wwwroot/api/cockpit_chat.dspy index ec9b926..9f136c5 100644 --- a/wwwroot/api/cockpit_chat.dspy +++ b/wwwroot/api/cockpit_chat.dspy @@ -426,7 +426,7 @@ async def _exec_tool(sor, tool, params, ctx, uid, org_id): # 3) Pending questions qs = await sor.sqlExe("SELECT id,question,status,task_id FROM pipeline_agent_questions WHERE tenant_id=${p}$ AND status='pending' LIMIT 5",{"p":pid}) # 4) Running tasks - running = await sor.sqlExe("SELECT id,title,role FROM pipeline_tasks WHERE tenant_id=${p}$ AND state='running' LIMIT 5",{"p":pid}) + running = await sor.sqlExe("SELECT id,title,role,claimed_by,TIMESTAMPDIFF(MINUTE,updated_at,NOW()) AS mins FROM pipeline_tasks WHERE tenant_id=${p}$ AND state='running' LIMIT 5",{"p":pid}) # 5) Review tasks review = await sor.sqlExe("SELECT id,title,role FROM pipeline_tasks WHERE tenant_id=${p}$ AND state='review' LIMIT 5",{"p":pid}) lines = [f"项目诊断: {ctx['pname']}"] @@ -441,7 +441,14 @@ async def _exec_tool(sor, tool, params, ctx, uid, org_id): if running: lines.append(f"\n🔄 运行中({len(running)}个):") for t in running: - lines.append(f" [{t.role}] {t.title[:60]}") + m = 0 + try: + m = int(getattr(t,'mins',0) or 0) + except Exception: + pass + cb = (getattr(t,'claimed_by','') or '')[:8] + flag = f"⚠️心跳超时{m}分钟(疑似僵尸)" if m >= 10 else f"已运行{m}分钟" + lines.append(f" [{t.role}] {t.title[:50]} | {flag} | claimed={cb}") if review: lines.append(f"\n👀 待审核({len(review)}个):") for t in review: