refactor: Remove cross-chat override sync
keyboardstaff committed
Mar 19, 2026 at 02:00 UTC
4494d30fe531acd866ac391046ac2ca484c2457b
3 files changed
+6
-27
plugins/_model_config/api/model_override.py
+3
-24
@@ -4,24 +4,6 @@ from agent import AgentContext
4
from plugins._model_config.helpers import model_config
5
6
7
-def _sync_override_to_project(ctx: AgentContext, override_value) -> int:
8
- """Apply the same override to all other contexts sharing the same project.
9
- Returns the number of synced contexts."""
10
- current_project = ctx.get_data("project") # str or None
11
- synced = 0
12
- for other in AgentContext.all():
13
- if other.id == ctx.id:
14
- continue
15
- if other.get_data("project") == current_project:
16
- other.set_data("chat_model_override", override_value)
17
- save_tmp_chat(other)
18
- synced += 1
19
- if synced:
20
- from helpers.state_monitor_integration import mark_dirty_all
21
- mark_dirty_all(reason="model_override.sync_project")
22
- return synced
23
-
24
-
7
class ModelOverride(ApiHandler):
8
async def process(self, input: dict, request: Request) -> dict | Response:
9
context_id = input.get("context_id", "")
@@ -47,8 +29,7 @@ class ModelOverride(ApiHandler):
29
return Response(status=400, response="Missing or invalid override config")
30
ctx.set_data("chat_model_override", override_config)
31
save_tmp_chat(ctx)
50
- synced = _sync_override_to_project(ctx, override_config)
51
- return {"ok": True, "override": override_config, "synced_count": synced}
32
+ return {"ok": True, "override": override_config}
33
34
elif action == "set_preset":
35
if not model_config.is_chat_override_allowed(ctx.agent0):
@@ -64,13 +45,11 @@ class ModelOverride(ApiHandler):
45
override_value = {"preset_name": preset_name}
46
ctx.set_data("chat_model_override", override_value)
47
save_tmp_chat(ctx)
67
- synced = _sync_override_to_project(ctx, override_value)
68
- return {"ok": True, "preset_name": preset_name, "synced_count": synced}
48
+ return {"ok": True, "preset_name": preset_name}
49
50
elif action == "clear":
51
ctx.set_data("chat_model_override", None)
52
save_tmp_chat(ctx)
73
- synced = _sync_override_to_project(ctx, None)
74
- return {"ok": True, "override": None, "synced_count": synced}
53
+ return {"ok": True, "override": None}
54
55
return Response(status=400, response=f"Unknown action: {action}")
plugins/_model_config/webui/config.html
+2
-2
@@ -18,12 +18,12 @@
18
<!-- Per-Chat Override -->
19
<div class="model-section">
20
<div class="section-title">Per-Chat Override</div>
21
- <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>
21
+ <div class="section-description">Allow switching model presets from the chat navigation bar. New chats inherit the active preset.</div>
22
23
<div class="field">
24
<div class="field-label">
25
<div class="field-title">Enable model switcher</div>
26
- <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>
26
+ <div class="field-description">Show a preset switcher in the chat navigation bar. Overrides main and utility model for the current chat.</div>
27
</div>
28
<div class="field-control">
29
<label class="toggle">
plugins/_model_config/webui/main.html
+1
-1
@@ -16,7 +16,7 @@
16
<div class="presets-page" x-data="{ presets: JSON.parse(JSON.stringify($store.modelConfig.globalPresets)) }">
17
<div class="presets-header">
18
<div class="field-title" style="font-size:1rem;">Model Presets</div>
19
- <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>
19
+ <div class="field-description">Global presets shared across all projects and agents. Used by the model switcher in the chat area.</div>
20
</div>
21
22
<template x-for="(preset, idx) in presets" :key="idx">