revert backend to 0x0a, frontend index.ui has hook with XHR+0x0a split

This commit is contained in:
ymq 2026-08-08 23:00:28 +08:00
parent 3377e6686b
commit 6f5e989b89

View File

@ -211,7 +211,7 @@ if action == 'send_message':
ctx = await _load_ctx(sor, uid)
model = await _sel_model(sor, user_model_id)
if not model:
d = json.dumps({"error": "没有可用的LLM模型配置"}, ensure_ascii=False)+chr(92)+chr(110)
d = json.dumps({"error": "没有可用的LLM模型配置"}, ensure_ascii=False)+'\n'
debug(f"YIELD error: {d[:80]}")
yield d
return
@ -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)+chr(92)+chr(110)
d = json.dumps({"content": 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)+chr(92)+chr(110)
d = json.dumps({"content": f"{'✅' if ok else '❌'} {label}: {result}"}, 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)+chr(92)+chr(110)
d = json.dumps({"content": 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'})