diff --git a/docs/dsh-architecture.md b/docs/dsh-architecture.md index 97e227e..d7c2f1b 100644 --- a/docs/dsh-architecture.md +++ b/docs/dsh-architecture.md @@ -77,7 +77,40 @@ DSH routes user requests across specialized AI services and local house infrastr --- -## 5. API Endpoints & Request Flow +## 5. Model Selection (the chat dropdown) + +**The model list is hardcoded in `dsh/app.py`** (`MODEL_CHOICES`, ~line 660). DSH does +**not** discover models from OmniRoute. `GET /api/models` simply returns that list +plus `MODEL_LABELS` for the friendly names. + +Consequence: a model can exist in OmniRoute and still be invisible in DSH until it +is added to `MODEL_CHOICES` **and** `MODEL_LABELS`. + +A chosen model is validated server-side (`if active_model not in MODEL_CHOICES: +active_model = LLM_MODEL`), so an unlisted id silently falls back to the default. + +### Adding a model + +1. Confirm it works through OmniRoute first — `curl http://127.0.0.1:20129/v1/models` + and then a real `chat/completions` call with a short timeout. +2. Add the id to `MODEL_CHOICES` and a friendly string to `MODEL_LABELS` in + `dsh/app.py`. +3. Deploy: copy `app.py` to `.13:/home/sam/Docker/Containers/dsh/`, then + `docker compose build && docker compose up -d` in that directory (the image + bakes `app.py` via `COPY . .`, so a rebuild is required — restarting is not enough). +4. Verify: `curl -s http://127.0.0.1:3081/api/models` should list the new id. + +### Local Ollama models + +The `.27` models are exposed by OmniRoute as `ollama/qwen2.5:14b` and +`ollama/qwen2.5-coder:14b` (`ollama-local/…` also exists but is duplicated). +Because Ollama now starts **off** at boot, these fail until it is started from the +family console; hence the `needs Ollama on` label. Inference is CPU-only on `.27`, +so expect it to be slower than the cloud routes. + +--- + +## 6. API Endpoints & Request Flow ### Primary API Routes (`dsh/app.py`) @@ -96,7 +129,7 @@ DSH routes user requests across specialized AI services and local house infrastr --- -## 6. Embedding & Security Headers +## 8. Embedding & Security Headers To support seamless inline framing inside the Family Home Lab Console (`/tool/dsh`): - **Content Security Policy (CSP)**: `frame-ancestors https://console.lab.audasmedia.com.au` @@ -104,7 +137,7 @@ To support seamless inline framing inside the Family Home Lab Console (`/tool/ds --- -## 7. Environment Variables Reference +## 9. Environment Variables Reference | Variable | Default Value | Purpose | | :--- | :--- | :--- | diff --git a/dsh/app.py b/dsh/app.py index b2c3b56..55c9637 100644 --- a/dsh/app.py +++ b/dsh/app.py @@ -665,6 +665,11 @@ MODEL_CHOICES = ["auto/best-chat", "auto/best-reasoning", "auto/best-coding", "auto/best-vision", + # Local models on .27, reached through OmniRoute. Free to run, but + # Ollama must be started first (family console -> AI Tools -> + # Ollama Local LLM). CPU inference, so slower than the cloud ones. + "ollama/qwen2.5:14b", + "ollama/qwen2.5-coder:14b", "openrouter/deepseek/deepseek-v4-flash", "openrouter/deepseek/deepseek-v4-pro"] MODEL_LABELS = { @@ -676,6 +681,8 @@ MODEL_LABELS = { "auto/best-reasoning": "Reasoning · OmniRoute best", "auto/best-coding": "Coding · OmniRoute best", "auto/best-vision": "Multimodal · OmniRoute vision", + "ollama/qwen2.5:14b": "Local · Qwen2.5 14B (.27, needs Ollama on)", + "ollama/qwen2.5-coder:14b": "Local · Qwen2.5 Coder 14B (.27, needs Ollama on)", "openrouter/deepseek/deepseek-v4-flash": "DeepSeek v4 flash (OpenRouter)", "openrouter/deepseek/deepseek-v4-pro": "DeepSeek v4 pro (OpenRouter)", }