Fix model config snapshot sync
Alessandro committed
Jun 2, 2026 at 00:22 UTC
ff601d08d04492d2f65f3919a26b73c5784b3f61
2 files changed
+12
-1
plugins/_model_config/webui/config.html
+4
-1
@@ -11,8 +11,11 @@
11
x-effect="
12
if (config && config !== lastConfig) {
13
lastConfig = config;
14
+ const snapshotBeforeInit = typeof context !== 'undefined'
15
+ ? context._toComparableJson(config)
16
+ : null;
17
$store.modelConfig.initConfigFields(config);
15
- if (typeof context !== 'undefined') {
18
+ if (typeof context !== 'undefined' && context.settingsSnapshotJson === snapshotBeforeInit) {
19
context.settingsSnapshotJson = context._toComparableJson(config);
20
}
21
}
tests/test_model_config_api_keys.py
+8
@@ -118,6 +118,14 @@ def test_model_config_frontend_tracks_inline_api_key_edits():
118
assert "$store.modelConfig.resetApiKeyDrafts();" in modal_content
119
120
121
+def test_model_config_snapshot_sync_only_adjusts_clean_loaded_configs():
122
+ config_path = PROJECT_ROOT / "plugins" / "_model_config" / "webui" / "config.html"
123
+ config_content = config_path.read_text(encoding="utf-8")
124
+
125
+ assert "const snapshotBeforeInit" in config_content
126
+ assert "context.settingsSnapshotJson === snapshotBeforeInit" in config_content
127
+
128
+
129
def test_model_switcher_frontend_renders_custom_overrides():
130
switcher_path = PROJECT_ROOT / "plugins" / "_model_config" / "webui" / "switcher-mixin.js"
131
refresh_extension_path = (