fix: AI 控制台实时画面跟随 AI 所选设备——后端 step 事件 args 原为 str() 的 Python repr(单引号),前端 JSON.parse 失败导致 followSerialFromArgs 从未生效;改为保留对象序列化,前端兼容对象/字符串并修 step 卡片 args 展示(避免 [object Object])

This commit is contained in:
2026-09-06 09:21:03 +08:00
parent edfd529c59
commit f7aa71cca4
2 changed files with 13 additions and 7 deletions
+3 -1
View File
@@ -594,8 +594,10 @@ def _agent_thread(run_id, prompt, serial, cfg):
tool_seq = [] # 本轮工具序列(经验提炼用)
def on_tool(step):
# args 保留对象(json.dumps 序列化)——前端要解析 serial 做画面跟随;
# 之前 str() 成 Python repr(单引号)导致前端 JSON.parse 失败、跟随失效
rec = {"tool": step.get("tool"),
"args": str(step.get("args"))[:200]}
"args": step.get("args") or {}}
if step.get("image"):
rec["image"] = _shrink_image(step["image"])
q.put(("step", rec))