Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

setup: the shared Chat settings file is no model config (#346)

Niko122162aaea4e14f6
diff --git a/setup.py b/setup.py
index 7668c3402..13e6fcfc3 100644
--- a/setup.py
+++ b/setup.py
@@ -2687,7 +2687,7 @@ def data_folder(requested: str | None) -> tuple:
(folder / d).rmdir() # empty now
except OSError:
pass
- for c in folder.glob("strata-*.json"):
+ for c in model_config_files(folder):
repoint_config(c, folder, dest)
if has_data(folder):
elsewhere.append(folder) # in use, or a copy the data folder already has
@@ -2803,13 +2803,19 @@ def readable_config(path: Path) -> bool:
return False
+def model_config_files(folder: Path) -> list:
+ """#346: the strata-*.json files of a folder that can be model configs. The server keeps a config's Chat settings
+ next to it as strata-<model>.shared-settings.json: it matches the pattern but is no config (no exe, no args)."""
+ return [p for p in folder.glob("strata-*.json") if not p.name.endswith(".shared-settings.json")]
+
+
def previous_config(elsewhere_first: list, settings: dict):
"""The most recently used model config of another Strata folder on this PC, for a folder that has none yet. One
that does not parse (an empty or cut-off file, #459) is skipped with a warning: the newest readable one is used,
and with none this copy is set up as a fresh install."""
cands = []
for folder in [*elsewhere_first, *other_installs(settings)]:
- cands += list(folder.glob("strata-*.json"))
+ cands += model_config_files(folder)
cands = [c for c in dict.fromkeys(cands) if c.is_file()]
return next((c for c in sorted(cands, key=lambda p: p.stat().st_mtime, reverse=True) if readable_config(c)), None)
@@ -2865,7 +2871,7 @@ def model_config(path: Path) -> bool:
def installed_configs():
- return [p for p in sorted(ROOT.glob("strata-*.json"), key=lambda p: p.stat().st_mtime, reverse=True)
+ return [p for p in sorted(model_config_files(ROOT), key=lambda p: p.stat().st_mtime, reverse=True)
if model_config(p)]
diff --git a/tools/strata_mcp.py b/tools/strata_mcp.py
index 563a598d6..8962d0933 100644
--- a/tools/strata_mcp.py
+++ b/tools/strata_mcp.py
@@ -480,7 +480,8 @@ class Strata:
# ---- what is installed
def configs(self) -> list[Path]:
- return sorted(self.root.glob("strata-*.json"), key=lambda p: p.stat().st_mtime, reverse=True)
+ return sorted((p for p in self.root.glob("strata-*.json") if not p.name.endswith(".shared-settings.json")),
+ key=lambda p: p.stat().st_mtime, reverse=True) # #346: the Chat settings file is no config
@staticmethod
def read_config(path: Path) -> dict:
diff --git a/tools/test_setup_configs.py b/tools/test_setup_configs.py
new file mode 100644
index 000000000..1ef019471
--- /dev/null
+++ b/tools/test_setup_configs.py
@@ -0,0 +1,63 @@
+"""Tests for the model configs setup.py lists: the server keeps a config's Chat settings next to it as
+`strata-<model>.shared-settings.json`, which matches the configs' own `strata-*.json` but is not one (no exe, no
+args), so the start menu and the "set up like the last one" lookup must leave it out.
+
+ python -m unittest tools.test_setup_configs
+"""
+from __future__ import annotations
+
+import json
+import os
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+from unittest import mock
+
+ROOT = Path(__file__).resolve().parents[1]
+sys.path.insert(0, str(ROOT))
+sys.path.insert(0, str(ROOT / "tools"))
+import setup # noqa: E402
+
+CONFIG = {"exe": "engine/strata.exe", "args": ["--max-context", "131072"]}
+SHARED = {"reasoning_effort": "high", "temperature": 0.6}
+
+
+def write(folder: Path, name: str, data: dict) -> Path:
+ path = folder / name
+ path.write_text(json.dumps(data), encoding="utf-8")
+ return path
+
+
+class ModelConfigs(unittest.TestCase):
+ def setUp(self):
+ tmp = tempfile.TemporaryDirectory()
+ self.addCleanup(tmp.cleanup)
+ self.dir = Path(tmp.name)
+ self.config = write(self.dir, "strata-iq3_s.json", CONFIG)
+ self.shared = write(self.dir, "strata-iq3_s.shared-settings.json", SHARED)
+ # previous_config also looks into the Strata folders next to this checkout: keep the real ones out
+ patch = mock.patch.object(setup, "other_installs", return_value=[])
+ patch.start()
+ self.addCleanup(patch.stop)
+
+ def test_the_start_menu_lists_the_config_but_not_its_shared_settings(self):
+ with mock.patch.object(setup, "ROOT", self.dir):
+ self.assertEqual(setup.installed_configs(), [self.config])
+
+ def test_the_last_config_of_another_install_is_never_its_shared_settings(self):
+ # the shared settings are written after the config (the first time Chat settings are saved), so they are
+ # the newest strata-*.json there
+ later = self.config.stat().st_mtime + 60
+ os.utime(self.shared, (later, later))
+ self.assertEqual(setup.previous_config([self.dir], {}), self.config)
+
+ def test_a_folder_with_only_shared_settings_has_no_config(self):
+ self.config.unlink()
+ with mock.patch.object(setup, "ROOT", self.dir):
+ self.assertEqual(setup.installed_configs(), [])
+ self.assertIsNone(setup.previous_config([self.dir], {}))
+
+
+if __name__ == "__main__":
+ unittest.main()