aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/assistant/Models.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-23 17:10:00 +0200
committerDanilo M. <danix@danix.xyz>2026-10-23 17:10:00 +0200
commit9b8b64da15bd6f96f228736f8604aef003304e72 (patch)
treeadc10cea30fa7317d1901ee6fb4771ac4b8723df /desktop/assistant/Models.qml
parente7de6f62f438acfa723961000c558b4d9f9da35f (diff)
downloadquickshell-9b8b64da15bd6f96f228736f8604aef003304e72.tar.gz
quickshell-9b8b64da15bd6f96f228736f8604aef003304e72.zip
assistant: pick the chat's model, local or cloud, from the header
The canvas keeps the chat's model from the daemon (hello.chat_model, conversation.model), falls back to the preferred one (set from shell.qml later), and sends it as model with every ask, typed or spoken. The To .md write stays without one: the daemon always writes with the local model. Models.qml lists the daemon's models event, router models then cloud ones, in a panel like History. It opens from the header label in chat, from a Model button next to History outside chat, and with Ctrl+M. The models are asked for on hello too, so the cloud marker is right before the panel was ever opened. Moving a chat with turns to a cloud model says once that its history goes to that provider. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/assistant/Models.qml')
-rw-r--r--desktop/assistant/Models.qml87
1 files changed, 87 insertions, 0 deletions
diff --git a/desktop/assistant/Models.qml b/desktop/assistant/Models.qml
new file mode 100644
index 0000000..b1b2a38
--- /dev/null
+++ b/desktop/assistant/Models.qml
@@ -0,0 +1,87 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+import ".."
+
+// The model panel, over the transcript: the router's models, then the
+// cloud ones, in the daemon's order. A pick applies to this chat from its
+// next question.
+Rectangle {
+ id: panel
+ property var canvas
+
+ color: Qt.alpha(Theme.base, 0.97)
+ radius: 8
+
+ MouseArea { anchors.fill: parent } // keep clicks off the transcript below
+
+ ListView {
+ id: rows
+ anchors.fill: parent
+ clip: true
+ spacing: 2
+ model: panel.canvas.models
+
+ delegate: Rectangle {
+ id: r
+ required property var modelData
+ readonly property bool picked: r.modelData.id === panel.canvas.wanted
+ width: rows.width
+ height: 34
+ radius: 6
+ color: hover.hovered ? Qt.alpha(Theme.surface, 0.9) : "transparent"
+ border.width: r.picked ? 1 : 0
+ border.color: Qt.alpha(Theme.accent, 0.5)
+
+ HoverHandler { id: hover }
+ MouseArea {
+ anchors.fill: parent
+ cursorShape: Qt.PointingHandCursor
+ onClicked: panel.canvas.pickModel(r.modelData.id)
+ }
+ // nf-fa-cloud, present in Inconsolata Nerd Font.
+ Text {
+ id: icon
+ anchors { left: parent.left; leftMargin: 8; verticalCenter: parent.verticalCenter }
+ width: 16
+ text: r.modelData.cloud ? "" : ""
+ color: Theme.subtext
+ font { family: Theme.iconFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ Text {
+ anchors { left: icon.right; leftMargin: 6; right: stat.left; rightMargin: 8
+ verticalCenter: parent.verticalCenter }
+ // A cloud id without its provider: the right column says it.
+ text: r.modelData.cloud ? r.modelData.id.slice(r.modelData.provider.length + 1)
+ : r.modelData.id
+ elide: Text.ElideRight
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: r.picked }
+ }
+ Text {
+ id: stat
+ anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter }
+ text: r.modelData.cloud ? r.modelData.provider : r.modelData.status
+ color: r.modelData.status === "loaded" ? Theme.green : Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ }
+
+ Text {
+ anchors.centerIn: parent
+ visible: rows.count === 0
+ text: "No models: is llama-server running?"
+ color: Theme.overlay
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ }
+ }
+}