diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-17 11:53:41 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-17 11:53:41 +0100 |
| commit | 4f1242ca873df8c167530475fcbd80808dc94a7d (patch) | |
| tree | 4d8a62c1eb31b1967454354d87cb0ce74ca0a2d7 | |
| parent | 474ddd078d0d976a84e88b8003bbf0cee40a2aaa (diff) | |
| download | quickshell-4f1242ca873df8c167530475fcbd80808dc94a7d.tar.gz quickshell-4f1242ca873df8c167530475fcbd80808dc94a7d.zip | |
assistant: output folder from the daemon's out_dir
The settings page edits out_dir in the daemon's config.toml, with
the daemon's resolved default as placeholder; the canvas takes the
folder from hello instead of asking xdg-user-dir itself.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | desktop/assistant/Assistant.qml | 15 | ||||
| -rw-r--r-- | desktop/modules/assistant/AssistantModule.qml | 8 | ||||
| -rw-r--r-- | desktop/modules/assistant/AssistantPage.qml | 19 |
3 files changed, 26 insertions, 16 deletions
diff --git a/desktop/assistant/Assistant.qml b/desktop/assistant/Assistant.qml index d6863a0..7d299eb 100644 --- a/desktop/assistant/Assistant.qml +++ b/desktop/assistant/Assistant.qml @@ -49,7 +49,7 @@ Scope { property int opChars: 0 property var opOut: [] property string opError: "" - // Results folder: $(xdg-user-dir DOCUMENTS)/Assistant, read once. + // Results folder: the daemon's out_dir, from hello; this until then. property string outDir: (Quickshell.env("HOME") || "") + "/Documents/Assistant" readonly property string fileops: decodeURIComponent(Qt.resolvedUrl("fileops").toString().replace(/^file:\/\//, "")) @@ -281,18 +281,6 @@ Scope { } } - Process { - running: true - command: ["xdg-user-dir", "DOCUMENTS"] - stdout: StdioCollector { - // With no documents folder set, xdg-user-dir answers $HOME itself. - onStreamFinished: { - const d = text.trim(); - if (d.startsWith("/") && d !== Quickshell.env("HOME")) root.outDir = d + "/Assistant"; - } - } - } - // deck-it's Assistant tab look, from its config's [assistant] keys: the // backdrop picture, the user's avatar, and where the assistant's face is // in the backdrop ([centre x, centre y, size] in its pixels). Empty: no @@ -442,6 +430,7 @@ print(json.dumps({"bg": os.path.expanduser(a.get("background") or ""), root.runningTool = e.state === "tool" ? e.tool : ""; root.model = e.model ?? ""; root.chatModel = e.chat_model ?? ""; + if (e.out_dir) root.outDir = e.out_dir; root.ctxUsed = e.ctx_used; root.ctxMax = e.ctx_max; root.load(e.id, e.turns, e.pending); diff --git a/desktop/modules/assistant/AssistantModule.qml b/desktop/modules/assistant/AssistantModule.qml index 9e8adbc..6aefb1f 100644 --- a/desktop/modules/assistant/AssistantModule.qml +++ b/desktop/modules/assistant/AssistantModule.qml @@ -27,7 +27,8 @@ Module { settings: true group: "Assistant" keywords: ["llm", "model", "llama", "server", "prompt", "temperature", "thinking", - "rounds", "tools", "environment", "daemon", "restart", "cloud", "provider"] + "rounds", "tools", "environment", "daemon", "restart", "cloud", "provider", + "folder", "output", "documents"] readonly property string home: Quickshell.env("HOME") readonly property string daemonDir: home + "/Programming/GIT/desktop-assistant" @@ -38,9 +39,10 @@ Module { // The system interpreter, as for calctl: python3 on PATH is a pyenv shim. readonly property string python: "/usr/bin/python3" - readonly property var keys: ["llm", "system", "tool_rounds", "temperature", "thinking"] + readonly property var keys: ["llm", "system", "tool_rounds", "temperature", "thinking", "out_dir"] readonly property var labels: ({ llm: "Server", system: "System prompt", tool_rounds: "Tool rounds", - temperature: "Temperature", thinking: "Thinking" }) + temperature: "Temperature", thinking: "Thinking", + out_dir: "Output folder" }) // config.toml as last read or written; "" when there is none. The page // edits draft, which save() writes; base is the file the draft began diff --git a/desktop/modules/assistant/AssistantPage.qml b/desktop/modules/assistant/AssistantPage.qml index d74e66b..0875a5d 100644 --- a/desktop/modules/assistant/AssistantPage.qml +++ b/desktop/modules/assistant/AssistantPage.qml @@ -359,6 +359,25 @@ Column { } } + Labelled { + objectName: "key:out_dir" + label: "Output folder" + Field { + anchors.fill: parent + value: page.v.out_dir ?? "" + placeholder: page.d.out_dir ?? "" + bad: page.asst.invalid["key:out_dir"] ?? false + // Where the canvas and tools write files; the daemon refuses + // anything but an absolute or ~ path, so a bad one never saves. + onEdited: t => { + const s = t.trim(); + const ok = s === "" || s.startsWith("/") || s === "~" || s.startsWith("~/"); + page.asst.markInvalid("key:out_dir", !ok); + if (ok) page.asst.setKey("out_dir", s ? page.asst.quote(s) : null); + } + } + } + // The prompt is long and multi-line, so it gets its own box and an // explicit Save rather than Enter. Column { |
