Add model dropdowns to settings and set qwen2.5:1.5b as intent default

- Default OLLAMA_INTENT_MODEL to qwen2.5:1.5b in code instead of empty
- Add GET /api/settings/models endpoint returning installed models and defaults
- Validate intent_model against installed models on save (same as default_model)
- Replace intent model text input with a dropdown of installed models
- Add chat model dropdown to Assistant settings section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-25 22:17:45 -05:00
parent 7b6248c8a7
commit f45b7cf9c5
3 changed files with 51 additions and 18 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ class Config:
OLLAMA_MODEL: str = os.environ.get("OLLAMA_MODEL", "qwen3")
# Optional dedicated model for intent classification (should be small/fast).
# Falls back to OLLAMA_MODEL if not set. Can also be overridden per-user via settings.
OLLAMA_INTENT_MODEL: str = os.environ.get("OLLAMA_INTENT_MODEL", "")
OLLAMA_INTENT_MODEL: str = os.environ.get("OLLAMA_INTENT_MODEL", "qwen2.5:1.5b")
# KV cache context window for generation. Lower = less VRAM, less throughput impact.
# 8192 is sufficient for most conversations; raise if you paste large documents.
OLLAMA_NUM_CTX: int = int(os.environ.get("OLLAMA_NUM_CTX", "8192"))
+19 -4
View File
@@ -1,6 +1,7 @@
from quart import Blueprint, jsonify, request
from fabledassistant.auth import login_required, get_current_user_id
from fabledassistant.config import Config
from fabledassistant.services.caldav import CALDAV_SETTING_KEYS, get_caldav_config, test_connection
from fabledassistant.services.llm import get_installed_models
from fabledassistant.services.settings import get_all_settings, set_settings_batch
@@ -24,17 +25,31 @@ async def update_settings_route():
if not isinstance(data, dict):
return jsonify({"error": "Expected a JSON object"}), 400
if "default_model" in data:
model = str(data["default_model"])
if "default_model" in data or "intent_model" in data:
installed = await get_installed_models()
if installed and model not in installed:
return jsonify({"error": f"Model '{model}' is not installed"}), 400
for key in ("default_model", "intent_model"):
if key in data and data[key]:
model = str(data[key])
if installed and model not in installed:
return jsonify({"error": f"Model '{model}' is not installed"}), 400
await set_settings_batch(uid, {k: str(v) for k, v in data.items()})
settings = await get_all_settings(uid)
return jsonify(settings)
@settings_bp.route("/models", methods=["GET"])
@login_required
async def get_models_route():
"""Return installed Ollama models and the configured defaults."""
models = sorted(await get_installed_models())
return jsonify({
"models": models,
"default_chat_model": Config.OLLAMA_MODEL,
"default_intent_model": Config.OLLAMA_INTENT_MODEL,
})
@settings_bp.route("/caldav", methods=["GET"])
@login_required
async def get_caldav():