aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/assistant/Models.qml
diff options
context:
space:
mode:
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 }
+ }
+ }
+}