From 885d65a2bbcde0e8e5094ae4589647875ee5838d Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 17 Oct 2026 10:50:09 +0200 Subject: assistant: pick the preferred model, loaded on demand The daemon answers with whichever model llama-server has loaded and never asks for one, so it never evicts a model another client is using. The Assistant settings page now lists the router's models with their state. Load saves one as the preferred model, in Prefs, and asks the router to load it now, polling /v1/models until it reports loaded; Prefer marks the loaded model as preferred without swapping. The swap happens only on that click, so the daemon's rule holds. AGENTS.md records the router's load endpoint and its two refusals, both measured: it lives on the server root, not under /v1. Co-Authored-By: Claude Opus 5.5 --- desktop/Prefs.qml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'desktop/Prefs.qml') diff --git a/desktop/Prefs.qml b/desktop/Prefs.qml index 9f89a7f..ba567c4 100644 --- a/desktop/Prefs.qml +++ b/desktop/Prefs.qml @@ -35,6 +35,16 @@ Singleton { // (assistant/Presets.js, which also validates what is read here). property var presets: null + // The router model preferred for the assistant, "" for none. The daemon + // still uses whatever is loaded; the settings page loads this on demand. + property string assistantModel: "" + function setAssistantModel(id) { + if (id === root.assistantModel) return; + root.assistantModel = id; + const a = Object.assign({}, root.doc.assistant, { model: id }); + root.write(Object.assign({}, root.doc, { assistant: a })); + } + // The settings window's sidebar width, dragged by its edge. readonly property int sidebarMin: 160 readonly property int sidebarMax: 420 @@ -88,6 +98,8 @@ Singleton { if (pin !== root.pinnedIp) root.pinnedIp = pin; root.presets = parsed.assistant && parsed.assistant.presets !== undefined ? parsed.assistant.presets : null; + root.assistantModel = parsed.assistant && typeof parsed.assistant.model === "string" + ? parsed.assistant.model : ""; const w = parsed.settings ? parsed.settings.sidebar : undefined; root.settingsSidebar = typeof w === "number" && w >= root.sidebarMin && w <= root.sidebarMax ? Math.round(w) : 200; @@ -105,6 +117,6 @@ Singleton { onFileChanged: reload() onLoaded: root.reparse() // Missing file: the defaults, and nothing written. - onLoadFailed: { root.doc = {}; root.pinnedIp = ""; root.presets = null; root.settingsSidebar = 200; } + onLoadFailed: { root.doc = {}; root.pinnedIp = ""; root.presets = null; root.settingsSidebar = 200; root.assistantModel = ""; } } } -- cgit v1.2.3