diff --git a/src/lib/components/chat/FileNav.svelte b/src/lib/components/chat/FileNav.svelte
index f8dfd4f067..a7fb4b7103 100644
--- a/src/lib/components/chat/FileNav.svelte
+++ b/src/lib/components/chat/FileNav.svelte
@@ -465,11 +465,14 @@
return isInsideFileRoot(path) ? asDirectoryPath(path) : fileRoot.path;
};
- const applyCwd = (cwd: TerminalCwd | null) => {
+ const applyCwd = (cwd: TerminalCwd | null, preferredPath?: string) => {
const cwdPath = cwd?.cwd ? asDirectoryPath(cwd.cwd) : null;
const homePath = cwd?.home ? asDirectoryPath(cwd.home) : null;
+ const preferredDirectory = preferredPath ? asDirectoryPath(preferredPath) : null;
+ const pathForRoot =
+ preferredDirectory && preferredDirectory !== '/' ? preferredDirectory : cwdPath;
const homeRoot =
- homePath && cwdPath && (cwdPath === homePath || cwdPath.startsWith(homePath))
+ homePath && pathForRoot && (pathForRoot === homePath || pathForRoot.startsWith(homePath))
? { path: homePath, label: 'Home' }
: undefined;
const rootPath = cwd?.root?.path ? asDirectoryPath(cwd.root.path) : null;
@@ -1137,18 +1140,20 @@
if (!handledDisplayFile && terminal) {
loading = true;
- void (async () => {
- // Discover server features on initial mount
- const config = await getTerminalConfig(terminal.url, terminal.key);
- terminalEnabled = config?.features?.terminal !== false;
+ void (async () => {
+ // Discover server features on initial mount
+ const config = await getTerminalConfig(terminal.url, terminal.key);
+ terminalEnabled = config?.features?.terminal !== false;
- if (chatId || savedPath === '/') {
- // Fetch session-specific cwd from the server (or global default for new chats)
- savedPath = applyCwd(await getCwd(terminal.url, terminal.key, chatId ?? undefined));
- }
- savedPath = clampToFileRoot(savedPath);
- loadDir(savedPath, { restoreTree: true });
- })();
+ const serverCwd = await getCwd(terminal.url, terminal.key, chatId ?? undefined);
+ const serverPath = applyCwd(serverCwd, savedPath);
+ if (chatId || savedPath === '/') {
+ // Fetch session-specific cwd from the server (or global default for new chats)
+ savedPath = serverPath;
+ }
+ savedPath = clampToFileRoot(savedPath);
+ loadDir(savedPath, { restoreTree: true });
+ })();
}
mounted = true;
diff --git a/src/lib/components/chat/FileNav/Icon.svelte b/src/lib/components/chat/FileNav/Icon.svelte
index 1227ad1713..5fa7f4b5a6 100644
--- a/src/lib/components/chat/FileNav/Icon.svelte
+++ b/src/lib/components/chat/FileNav/Icon.svelte
@@ -377,6 +377,28 @@
fill="currentColor"
stroke="none">PDF
+ {:else if name === 'docx-logo'}
+
+
+
+
+
+ {:else if name === 'xlsx-logo'}
+
+
+
+
+
+ {:else if name === 'pptx-logo'}
+
+
+
{:else if name === 'npm'}
diff --git a/src/lib/components/chat/FileNav/fileIcon.ts b/src/lib/components/chat/FileNav/fileIcon.ts
index b7c12397dd..4e3454a590 100644
--- a/src/lib/components/chat/FileNav/fileIcon.ts
+++ b/src/lib/components/chat/FileNav/fileIcon.ts
@@ -149,13 +149,14 @@ export function fileIconName(name: string, type: string = 'file'): string {
case 'rar':
return 'archive';
case 'docx':
+ return 'docx-logo';
case 'txt':
return 'page-text';
case 'xlsx':
case 'xls':
- return 'table';
+ return 'xlsx-logo';
case 'pptx':
- return 'page';
+ return 'pptx-logo';
default:
return 'empty-page';
}