This commit is contained in:
Timothy Jaeryang Baek committed 2026-08-22 08:21:53 -04:00
1 parent d7d935275a
commit 1b3b9375bb
3 files changed
+41 -38

No files matched your search

+12 -12
View File
@@ -1173,21 +1173,21 @@
return; return;
} }
const lastSlash = filePath.lastIndexOf('/'); const lastSlash = filePath.lastIndexOf('/');
const dir = lastSlash > 0 ? filePath.substring(0, lastSlash + 1) : '/'; const dir = lastSlash > 0 ? filePath.substring(0, lastSlash + 1) : '/';
invalidateTreeCache(dir); invalidateTreeCache(dir);
if (selectedFile) { if (selectedFile) {
if (selectedFile === filePath || currentPath.startsWith(dir)) { if (selectedFile === filePath || currentPath.startsWith(dir)) {
const fileName = selectedFile.split('/').pop() ?? ''; const fileName = selectedFile.split('/').pop() ?? '';
await openEntry({ name: fileName, type: 'file', size: 0 }); await openEntry({ name: fileName, type: 'file', size: 0 });
} }
} else { } else {
if (currentPath.startsWith(dir) || dir.startsWith(currentPath)) { if (currentPath.startsWith(dir) || dir.startsWith(currentPath)) {
await refreshBrowser(); await refreshBrowser();
}
} }
}); }
});
if (!handledDisplayFile && terminal) { if (!handledDisplayFile && terminal) {
loading = true; loading = true;
+21 -22
View File
@@ -33,12 +33,12 @@
toolServers, toolServers,
terminalServers, terminalServers,
user as _user, user as _user,
showControls, showControls,
showSettings, showSettings,
showFileNavDir, showFileNavDir,
selectedTerminalId, selectedTerminalId,
TTSWorker, TTSWorker,
temporaryChatEnabled temporaryChatEnabled
} from '$lib/stores'; } from '$lib/stores';
import { import {
@@ -876,10 +876,7 @@
return ( return (
(settingsValue?.terminalServers ?? []).find( (settingsValue?.terminalServers ?? []).find(
(t: any) => (t: any) => t.url === selectedId && t.enabled && t.config?.chat_uploads === 'filesystem'
t.url === selectedId &&
t.enabled &&
t.config?.chat_uploads === 'filesystem'
) ?? null ) ?? null
); );
}; };
@@ -925,11 +922,13 @@
if (filesystemUploadTerminal) { if (filesystemUploadTerminal) {
try { try {
const cwd = const cwd =
(await getCwd( (
filesystemUploadTerminal.url, await getCwd(
filesystemUploadTerminal.key, filesystemUploadTerminal.url,
chatId || undefined filesystemUploadTerminal.key,
))?.cwd || '/'; chatId || undefined
)
)?.cwd || '/';
const uploadedFile = await uploadToTerminal( const uploadedFile = await uploadToTerminal(
filesystemUploadTerminal.url, filesystemUploadTerminal.url,
filesystemUploadTerminal.key, filesystemUploadTerminal.key,
@@ -939,16 +938,16 @@
); );
if (uploadedFile) { if (uploadedFile) {
fileItem.type = 'terminal_file'; fileItem.type = 'filesystem';
fileItem.status = 'uploaded'; fileItem.status = 'uploaded';
fileItem.id = uploadedFile.path; fileItem.id = uploadedFile.path;
fileItem.path = uploadedFile.path; fileItem.path = uploadedFile.path;
fileItem.url = uploadedFile.path; fileItem.url = uploadedFile.path;
fileItem.size = uploadedFile.size ?? file.size; fileItem.size = uploadedFile.size ?? file.size;
fileItem.file = uploadedFile; fileItem.file = uploadedFile;
files = files; files = files;
showFileNavDir.set(uploadedFile.path); showFileNavDir.set(uploadedFile.path);
} else { } else {
fileItem.status = 'error'; fileItem.status = 'error';
fileItem.error = $i18n.t('Failed to upload file.'); fileItem.error = $i18n.t('Failed to upload file.');
toast.error(fileItem.error); toast.error(fileItem.error);
+8 -4
View File
@@ -3,7 +3,7 @@
import { WEBUI_API_BASE_URL } from '$lib/constants'; import { WEBUI_API_BASE_URL } from '$lib/constants';
import { formatFileSize } from '$lib/utils'; import { formatFileSize } from '$lib/utils';
import { settings } from '$lib/stores'; import { settings, showFileNavPath } from '$lib/stores';
import FileItemModal from './FileItemModal.svelte'; import FileItemModal from './FileItemModal.svelte';
import GarbageBin from '../icons/GarbageBin.svelte'; import GarbageBin from '../icons/GarbageBin.svelte';
@@ -57,7 +57,11 @@
: 'gap-1 rounded-2xl p-1.5'} text-left" : 'gap-1 rounded-2xl p-1.5'} text-left"
type="button" type="button"
on:click={async () => { on:click={async () => {
if (item?.file?.data?.content || item?.type === 'file' || item?.content || modal) { const filesystemPath = item?.type === 'filesystem' ? (item.path ?? item.url ?? item.id) : null;
if (filesystemPath) {
showFileNavPath.set(filesystemPath);
} else if (item?.file?.data?.content || item?.type === 'file' || item?.content || modal) {
showModal = !showModal; showModal = !showModal;
} else { } else {
if (url) { if (url) {
@@ -111,7 +115,7 @@
? $i18n.t('Note') ? $i18n.t('Note')
: type === 'chat' : type === 'chat'
? $i18n.t('Chat') ? $i18n.t('Chat')
: type === 'file' : type === 'file' || type === 'filesystem'
? $i18n.t('File') ? $i18n.t('File')
: $i18n.t('Document')} : $i18n.t('Document')}
placement="top" placement="top"
@@ -145,7 +149,7 @@
? 'text-gray-800 dark:text-gray-100' ? 'text-gray-800 dark:text-gray-100'
: 'text-gray-500'}" : 'text-gray-500'}"
> >
{#if type === 'file'} {#if type === 'file' || type === 'filesystem'}
{$i18n.t('File')} {$i18n.t('File')}
{:else if type === 'note'} {:else if type === 'note'}
{$i18n.t('Note')} {$i18n.t('Note')}