summaryrefslogtreecommitdiffstats
path: root/desktop/modules/assistant/AssistantModule.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/assistant/AssistantModule.qml')
-rw-r--r--desktop/modules/assistant/AssistantModule.qml12
1 files changed, 12 insertions, 0 deletions
diff --git a/desktop/modules/assistant/AssistantModule.qml b/desktop/modules/assistant/AssistantModule.qml
index a05556d..9e8adbc 100644
--- a/desktop/modules/assistant/AssistantModule.qml
+++ b/desktop/modules/assistant/AssistantModule.qml
@@ -362,6 +362,18 @@ Module {
else { poll.left = 300; poll.start(); }
});
}
+ // Frees the VRAM for every client; the next request for the model, or
+ // the canvas opening, loads it again.
+ function unloadModel(id) {
+ am.modelError = "";
+ am.run(["curl", "-s", "-m", "30", "-X", "POST", "-H", "Content-Type: application/json",
+ "-d", JSON.stringify({ model: id }), am.routerRoot + "/models/unload"], null, (code, out) => {
+ let err = code === 0 ? "" : "the router did not answer";
+ try { const e = JSON.parse(out).error; if (e) err = e.message; } catch (x) {}
+ if (err) am.modelError = `${id}: ${err}`;
+ am.listModels();
+ });
+ }
// Called when the canvas opens and when its chat's model changes, with
// the chat's model, else the preferred one: loaded if it is a router
// model neither loaded nor loading. A cloud id is not in the router's