Agent Zero AI framework
refactor: Remove cross-chat override sync
keyboardstaff4494d30fe531
diff --git a/plugins/_model_config/api/model_override.py b/plugins/_model_config/api/model_override.pyindex 0fab65e03..038969edb 100644--- a/plugins/_model_config/api/model_override.py+++ b/plugins/_model_config/api/model_override.py@@ -4,24 +4,6 @@ from agent import AgentContextfrom plugins._model_config.helpers import model_config-def _sync_override_to_project(ctx: AgentContext, override_value) -> int:- """Apply the same override to all other contexts sharing the same project.- Returns the number of synced contexts."""- current_project = ctx.get_data("project") # str or None- synced = 0- for other in AgentContext.all():- if other.id == ctx.id:- continue- if other.get_data("project") == current_project:- other.set_data("chat_model_override", override_value)- save_tmp_chat(other)- synced += 1- if synced:- from helpers.state_monitor_integration import mark_dirty_all- mark_dirty_all(reason="model_override.sync_project")- return synced--class ModelOverride(ApiHandler):async def process(self, input: dict, request: Request) -> dict | Response:context_id = input.get("context_id", "")@@ -47,8 +29,7 @@ class ModelOverride(ApiHandler):return Response(status=400, response="Missing or invalid override config")ctx.set_data("chat_model_override", override_config)save_tmp_chat(ctx)- synced = _sync_override_to_project(ctx, override_config)- return {"ok": True, "override": override_config, "synced_count": synced}+ return {"ok": True, "override": override_config}elif action == "set_preset":if not model_config.is_chat_override_allowed(ctx.agent0):@@ -64,13 +45,11 @@ class ModelOverride(ApiHandler):override_value = {"preset_name": preset_name}ctx.set_data("chat_model_override", override_value)save_tmp_chat(ctx)- synced = _sync_override_to_project(ctx, override_value)- return {"ok": True, "preset_name": preset_name, "synced_count": synced}+ return {"ok": True, "preset_name": preset_name}elif action == "clear":ctx.set_data("chat_model_override", None)save_tmp_chat(ctx)- synced = _sync_override_to_project(ctx, None)- return {"ok": True, "override": None, "synced_count": synced}+ return {"ok": True, "override": None}return Response(status=400, response=f"Unknown action: {action}")diff --git a/plugins/_model_config/webui/config.html b/plugins/_model_config/webui/config.htmlindex 1990067f5..b2eccc8ea 100644--- a/plugins/_model_config/webui/config.html+++ b/plugins/_model_config/webui/config.html@@ -18,12 +18,12 @@<!-- Per-Chat Override --><div class="model-section"><div class="section-title">Per-Chat Override</div>- <div class="section-description">Allow switching model presets from the chat navigation bar. Changes sync across all chats in the same project, and new chats inherit the active preset.</div>+ <div class="section-description">Allow switching model presets from the chat navigation bar. New chats inherit the active preset.</div><div class="field"><div class="field-label"><div class="field-title">Enable model switcher</div>- <div class="field-description">Show a preset switcher in the chat navigation bar. Overrides main and utility model. Switching applies to all chats within the same project.</div>+ <div class="field-description">Show a preset switcher in the chat navigation bar. Overrides main and utility model for the current chat.</div></div><div class="field-control"><label class="toggle">diff --git a/plugins/_model_config/webui/main.html b/plugins/_model_config/webui/main.htmlindex b46b3f474..de0987d8b 100644--- a/plugins/_model_config/webui/main.html+++ b/plugins/_model_config/webui/main.html@@ -16,7 +16,7 @@<div class="presets-page" x-data="{ presets: JSON.parse(JSON.stringify($store.modelConfig.globalPresets)) }"><div class="presets-header"><div class="field-title" style="font-size:1rem;">Model Presets</div>- <div class="field-description">Global presets shared across all projects and agents. Used by the model switcher in the chat area. Switching a preset applies to all chats in the same project.</div>+ <div class="field-description">Global presets shared across all projects and agents. Used by the model switcher in the chat area.</div></div><template x-for="(preset, idx) in presets" :key="idx">