feat(models): auto-mode intent remap + real coder models in preference

Settings "Auto model routing" picks which installed model fires for chat vs
coding intent when no model is pinned (auto_chat_model / auto_code_model).
_auto_select_model honors the remap; _MODEL_PREFERENCE["code"] prefers real
coder models first.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jon
2026-07-23 16:06:46 -05:00
co-authored by Claude Opus 4.8
parent 9aea6d4228
commit 031e522704
5 changed files with 51 additions and 1 deletions
+13
View File
@@ -43,6 +43,19 @@ def test_keep_alive_pins_the_model():
assert "keep_alive" not in mgr._apply_keep_alive({"model": "x"})
def test_auto_model_remap(monkeypatch):
import asyncio
from synapse import main
cfg = {"model": "", "auto_chat_model": "chatX", "auto_code_model": "coderY"}
monkeypatch.setattr(main.store, "get_settings", lambda: cfg)
# code intent ("function") routes to the code remap; chat intent to the chat remap
assert asyncio.run(main._auto_select_model("write a function to sort a list")) == "coderY"
assert asyncio.run(main._auto_select_model("how are you today")) == "chatX"
# an explicit pin beats the remap
cfg["model"] = "pinnedZ"
assert asyncio.run(main._auto_select_model("debug this code")) == "pinnedZ"
def test_hardware_fit_logic():
from synapse import hardware
assert hardware._fit(2.5, 4.0, 16.0) == "gpu" # 2.5+1 <= 4 -> fits GPU