fix(gui): do not auto-add tool calls/results to discussion history if ui_auto_add_history is false

This commit is contained in:
2026-03-14 09:26:54 -04:00
parent b85b7d9700
commit 81ded98198

View File

@@ -1496,21 +1496,22 @@ class AppController:
}) })
if kind in ("tool_result", "tool_call"): if kind in ("tool_result", "tool_call"):
role = "Tool" if kind == "tool_result" else "Vendor API" if self.ui_auto_add_history:
content = "" role = "Tool" if kind == "tool_result" else "Vendor API"
if kind == "tool_result": content = ""
content = payload.get("output", "") if kind == "tool_result":
else: content = payload.get("output", "")
content = payload.get("script") or payload.get("args") or payload.get("message", "") else:
if isinstance(content, dict): content = payload.get("script") or payload.get("args") or payload.get("message", "")
content = json.dumps(content, indent=1) if isinstance(content, dict):
with self._pending_history_adds_lock: content = json.dumps(content, indent=1)
self._pending_history_adds.append({ with self._pending_history_adds_lock:
"role": role, self._pending_history_adds.append({
"content": f"[{kind.upper().replace('_', ' ')}]\n{content}", "role": role,
"collapsed": True, "content": f"[{kind.upper().replace('_', ' ')}]\n{content}",
"ts": entry.get("ts", project_manager.now_ts()) "collapsed": True,
}) "ts": entry.get("ts", project_manager.now_ts())
})
if kind == "history_add": if kind == "history_add":
payload = entry.get("payload", {}) payload = entry.get("payload", {})
with self._pending_history_adds_lock: with self._pending_history_adds_lock: