From 1b2ed1bc2e80eb775229d2843d8c8c63921feba8 Mon Sep 17 00:00:00 2001 From: Arjun <6592213+arkml@users.noreply.github.com> Date: Tue, 19 May 2026 10:31:37 +0530 Subject: [PATCH] default to workspace in set directory --- .../src/components/chat-input-with-mentions.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/x/apps/renderer/src/components/chat-input-with-mentions.tsx b/apps/x/apps/renderer/src/components/chat-input-with-mentions.tsx index ccd96805..97386508 100644 --- a/apps/x/apps/renderer/src/components/chat-input-with-mentions.tsx +++ b/apps/x/apps/renderer/src/components/chat-input-with-mentions.tsx @@ -274,9 +274,21 @@ function ChatInputInner({ const handleSetWorkDir = useCallback(async () => { try { + let defaultPath: string | undefined = workDir ?? undefined + try { + const { root } = await window.ipc.invoke('workspace:getRoot', null) + const workspaceRel = 'knowledge/Workspace' + const exists = await window.ipc.invoke('workspace:exists', { path: workspaceRel }) + if (!exists.exists) { + await window.ipc.invoke('workspace:mkdir', { path: workspaceRel, recursive: true }) + } + defaultPath = `${root.replace(/\/$/, '')}/${workspaceRel}` + } catch (err) { + console.error('Failed to resolve Workspace path; falling back to current workDir', err) + } const { path: chosen } = await window.ipc.invoke('dialog:openDirectory', { title: 'Choose work directory', - defaultPath: workDir ?? undefined, + defaultPath, }) if (!chosen) return await window.ipc.invoke('workspace:writeFile', {