diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-16 16:06:33 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-16 16:06:33 +0200 |
| commit | f6ceae477979b32869c0c17e2b1fc05477d6eb81 (patch) | |
| tree | 4fecf207f449e7a454d4ee80e28407ddfa63df2d /desktop/assistant/Card.qml | |
| parent | 9a0c898a7a3d6c134626f05508c63840477e4be3 (diff) | |
| download | quickshell-f6ceae477979b32869c0c17e2b1fc05477d6eb81.tar.gz quickshell-f6ceae477979b32869c0c17e2b1fc05477d6eb81.zip | |
feat(assistant): Ask presets in the file state
A row of canned questions matching every staged file's kind, plus Compare
for two or more files: one click asks it, Shift+click puts it in the input
to edit first. Defaults live in Presets.js and the list in use in Prefs, so
a future drawer settings page can edit it; a saved list that does not
validate reads as the defaults. Each prompt asks for an answer in the
document's language. Code and configuration get their own kind, so a
script is offered Explain and Review rather than Summarize. Button's
clicked signal carries the mouse event for the Shift check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/assistant/Card.qml')
| -rw-r--r-- | desktop/assistant/Card.qml | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/desktop/assistant/Card.qml b/desktop/assistant/Card.qml index 228cfdb..f63ce59 100644 --- a/desktop/assistant/Card.qml +++ b/desktop/assistant/Card.qml @@ -12,6 +12,7 @@ import QtQuick import ".." import "Files.js" as Files +import "Presets.js" as Presets // The card in its three states (Assistant.qml, mode): entry is the input // line alone; file adds the staged chips and what can be done with them; @@ -31,6 +32,7 @@ Rectangle { // Bottom-up: the input, then the actions (file state), then the chips. height: card.tall ? card.fullHeight : footer.height + 28 + (chips.visible ? chips.height + 10 : 0) + + (asks.visible ? asks.height + 10 : 0) + (actions.visible ? actions.height + 10 : 0) Behavior on height { NumberAnimation { duration: 180; easing.type: Easing.OutCubic } } clip: true @@ -151,7 +153,8 @@ Rectangle { id: chips visible: card.canvas.staged.length > 0 anchors { - bottom: actions.visible ? actions.top : footer.top; bottomMargin: 10 + bottom: asks.visible ? asks.top : actions.visible ? actions.top : footer.top + bottomMargin: 10 left: parent.left; right: parent.right; leftMargin: 14; rightMargin: 14 } spacing: 6 @@ -194,8 +197,38 @@ Rectangle { } // --- what to do with them (file) --- - // Piece 1 offers Chat about it; the Ask and Do rows (model prompts and - // local operations) are their own specs and land here. + // Ask: canned questions matching the staged kinds (Presets.js). A click + // sends one; Shift+click puts it in the input to edit first. The Do row + // (local operations) is its own spec and lands here too. + + Flow { + id: asks + readonly property var offered: Presets.offered(Presets.list(Prefs.presets), card.canvas.staged) + visible: card.mode === "file" && offered.length > 0 + anchors { + bottom: actions.top; bottomMargin: 10 + left: parent.left; right: parent.right; leftMargin: 14; rightMargin: 14 + } + spacing: 8 + + Repeater { + model: asks.offered + Button { + required property var modelData + text: modelData.label + enabled: card.canvas.connected && !card.canvas.blocked + onClicked: mouse => { + if (mouse && (mouse.modifiers & Qt.ShiftModifier)) { + input.text = Presets.prompt(modelData); + input.cursorPosition = input.text.length; + input.forceActiveFocus(); + } else { + card.canvas.ask(Presets.prompt(modelData)); + } + } + } + } + } Row { id: actions |
