From 426998b6c65e4ce93e08d3f1fc21c55cd66adc0a Mon Sep 17 00:00:00 2001 From: ymq Date: Sun, 9 Aug 2026 17:02:49 +0800 Subject: [PATCH] cockpit_chat: use _w_progress/_w_card/_w_text widget descriptors in yield stream --- wwwroot/api/cockpit_chat.dspy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wwwroot/api/cockpit_chat.dspy b/wwwroot/api/cockpit_chat.dspy index 8ad49db..16e2bd3 100644 --- a/wwwroot/api/cockpit_chat.dspy +++ b/wwwroot/api/cockpit_chat.dspy @@ -234,12 +234,12 @@ if action == 'send_message': if act.get('action') == 'tool_call': tool = act.get('tool','') label = _tool_labels.get(tool,tool) - d = json.dumps({"content": f"πŸ”„ {label}..."}, ensure_ascii=False)+'\n' + d = json.dumps(_w_progress(f"πŸ”„ {label}..."), ensure_ascii=False)+'\n' debug(f"YIELD progress: {d[:60]}") yield d result = await _exec_tool(sor, tool, act.get('params',{}), ctx, uid, org_id) ok = result.startswith("OK:") - d = json.dumps({"content": f"{'βœ…' if ok else '❌'} {label}: {result}"}, ensure_ascii=False)+'\n' + d = json.dumps(_w_card(label, _w_text(result), "success" if ok else "error"), ensure_ascii=False)+'\n' debug(f"YIELD result: {d[:60]}") yield d msgs.append({"role":"assistant","content":raw}) @@ -248,7 +248,7 @@ if action == 'send_message': agent_reply = raw; break if not agent_reply: agent_reply = "倄理袅既" - d = json.dumps({"content": agent_reply}, ensure_ascii=False)+'\n' + d = json.dumps(_w_text(agent_reply), ensure_ascii=False)+'\n' debug(f"YIELD final: {d[:60]}") yield d await sor.C('pipeline_conversations',{'id':getID(),'role':'agent','content':agent_reply,'msg_type':'text','org_id':org_id,'created_by':'system'})