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