aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/assistant/AssistantModule.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-17 10:53:17 +0200
committerDanilo M. <danix@danix.xyz>2026-10-17 10:53:17 +0200
commitca3c66d882e60874b1cf4a1c5f9ea4232a593255 (patch)
tree8ce9c36025ec1deea947866849060f5583533c7c /desktop/modules/assistant/AssistantModule.qml
parent885d65a2bbcde0e8e5094ae4589647875ee5838d (diff)
downloadquickshell-ca3c66d882e60874b1cf4a1c5f9ea4232a593255.tar.gz
quickshell-ca3c66d882e60874b1cf4a1c5f9ea4232a593255.zip
assistant: opening the canvas loads the preferred model
A preferred model that only took effect from the settings page did nothing the next time another client had swapped it out. On this desktop one model and one client run at a time, so opening the canvas is when the assistant's model should come back: if the preferred one is neither loaded nor loading, it is loaded, and the canvas header says so until the router reports it in. The daemon still never asks for a model; with no preference set nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/assistant/AssistantModule.qml')
-rw-r--r--desktop/modules/assistant/AssistantModule.qml13
1 files changed, 13 insertions, 0 deletions
diff --git a/desktop/modules/assistant/AssistantModule.qml b/desktop/modules/assistant/AssistantModule.qml
index a85b2b3..b53a33f 100644
--- a/desktop/modules/assistant/AssistantModule.qml
+++ b/desktop/modules/assistant/AssistantModule.qml
@@ -198,6 +198,19 @@ Module {
else { poll.left = 300; poll.start(); }
});
}
+ // Called when the assistant canvas opens: the preferred model, if one is
+ // set, still listed, and neither loaded nor loading, is loaded. One model
+ // and one client at a time is how this desktop runs, so opening the
+ // assistant is the moment to bring its model back.
+ function ensurePreferred() {
+ const id = Prefs.assistantModel;
+ if (id === "" || am.loading !== "") return;
+ am.listModels(() => {
+ const m = am.models.find(x => x.id === id);
+ if (m && m.status !== "loaded" && m.status !== "loading") am.loadModel(id);
+ });
+ }
+
property Timer poll: Timer {
property int left: 0
interval: 1000