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
+5
View File
@@ -104,6 +104,11 @@ async def _auto_select_model(message: str = "") -> str:
if s.get("model"):
return s["model"]
intent = _detect_intent(message) if message else "chat"
# Auto-mode remap: a configured model for this intent fires first;
# otherwise fall back to the built-in preference list.
remap = s.get(f"auto_{intent}_model")
if remap:
return remap
return await get_ollama_manager().select_best_model(intent)
except Exception:
return DEFAULT_CHAT_MODEL
+4
View File
@@ -986,6 +986,10 @@ class PersistentMemoryStore:
# -----------------------------
_SETTINGS_DEFAULTS: Dict[str, Any] = {
"model": "",
# Auto-mode routing overrides (blank = built-in preference). When no model
# is pinned, a message's detected intent picks which of these fires first.
"auto_chat_model": "",
"auto_code_model": "",
# Qwen3-style reasoning. Off by default: the hidden <think> block is pure
# latency for chat/memory. Turn on for hard multi-step problems.
"think": False,
+1 -1
View File
@@ -162,7 +162,7 @@ def _detect_gpu_backend() -> tuple[str, dict]:
# tail differs by task. Prefix-matched against installed model names.
_MODEL_PREFERENCE = {
"chat": ("qwen2.5:3b", "qwen2.5", "gemma3:1b", "gemma3", "phi3", "phi-3", "gemma2", "gemma"),
"code": ("qwen2.5:3b", "qwen2.5", "gemma3:1b", "gemma3", "phi3", "phi-3", "codellama", "deepseek-coder", "codegemma"),
"code": ("qwen2.5-coder", "qwen3-coder", "deepseek-coder", "codellama", "codegemma", "qwen2.5:3b", "qwen2.5", "gemma3", "phi3", "phi-3"),
}