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: