fix: use \\\\n (4 backslashes) for literal \\n delimiter — JS split('\\n') needs backslash-n
This commit is contained in:
parent
0b03b310f0
commit
33f49b13ff
@ -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)+'\n'
|
||||
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)+'\n'
|
||||
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)+'\n'
|
||||
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)+'\n'
|
||||
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'})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user