From f6ceae477979b32869c0c17e2b1fc05477d6eb81 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 16 Oct 2026 16:06:33 +0200 Subject: 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 --- desktop/Prefs.qml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'desktop/Prefs.qml') 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; } } } -- cgit v1.2.3