aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/Prefs.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-16 16:06:33 +0200
committerDanilo M. <danix@danix.xyz>2026-10-16 16:06:33 +0200
commitf6ceae477979b32869c0c17e2b1fc05477d6eb81 (patch)
tree4fecf207f449e7a454d4ee80e28407ddfa63df2d /desktop/Prefs.qml
parent9a0c898a7a3d6c134626f05508c63840477e4be3 (diff)
downloadquickshell-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/Prefs.qml')
-rw-r--r--desktop/Prefs.qml21
1 files changed, 20 insertions, 1 deletions
diff --git a/desktop/Prefs.qml b/desktop/Prefs.qml
index fa0dde9..def720c 100644
--- a/desktop/Prefs.qml
+++ b/desktop/Prefs.qml
@@ -31,6 +31,10 @@ Singleton {
// The public IP the user pinned from the performance panel; "" for none.
property string pinnedIp: ""
+ // The assistant's Ask presets as saved, or null for the defaults
+ // (assistant/Presets.js, which also validates what is read here).
+ property var presets: null
+
// The whole parsed object, so a write keeps keys this version does not
// know about.
property var doc: ({})
@@ -42,6 +46,19 @@ Singleton {
root.write(Object.assign({}, root.doc, { perf: perf }));
}
+ // For the settings page that will edit the presets.
+ function setPresets(list) {
+ root.presets = list;
+ const a = Object.assign({}, root.doc.assistant, { presets: list });
+ root.write(Object.assign({}, root.doc, { assistant: a }));
+ }
+ function resetPresets() {
+ root.presets = null;
+ const a = Object.assign({}, root.doc.assistant);
+ delete a.presets;
+ root.write(Object.assign({}, root.doc, { assistant: a }));
+ }
+
function write(out) {
root.doc = out;
file.setText(JSON.stringify(out, null, 2) + "\n");
@@ -56,6 +73,8 @@ Singleton {
root.doc = parsed;
const pin = parsed.perf && typeof parsed.perf.pinnedIp === "string" ? parsed.perf.pinnedIp : "";
if (pin !== root.pinnedIp) root.pinnedIp = pin;
+ root.presets = parsed.assistant && parsed.assistant.presets !== undefined
+ ? parsed.assistant.presets : null;
}
FileView {
@@ -70,6 +89,6 @@ Singleton {
onFileChanged: reload()
onLoaded: root.reparse()
// Missing file: the defaults, and nothing written.
- onLoadFailed: { root.doc = {}; root.pinnedIp = ""; }
+ onLoadFailed: { root.doc = {}; root.pinnedIp = ""; root.presets = null; }
}
}