mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-10 03:27:57 +00:00
refac
This commit is contained in:
parent
302ffc8b7e
commit
d7d935275a
2 changed files with 24 additions and 21 deletions
|
|
@ -1173,20 +1173,21 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const lastSlash = filePath.lastIndexOf('/');
|
||||
const dir = lastSlash > 0 ? filePath.substring(0, lastSlash + 1) : '/';
|
||||
const lastSlash = filePath.lastIndexOf('/');
|
||||
const dir = lastSlash > 0 ? filePath.substring(0, lastSlash + 1) : '/';
|
||||
invalidateTreeCache(dir);
|
||||
|
||||
if (selectedFile) {
|
||||
if (selectedFile === filePath || currentPath.startsWith(dir)) {
|
||||
const fileName = selectedFile.split('/').pop() ?? '';
|
||||
await openEntry({ name: fileName, type: 'file', size: 0 });
|
||||
if (selectedFile) {
|
||||
if (selectedFile === filePath || currentPath.startsWith(dir)) {
|
||||
const fileName = selectedFile.split('/').pop() ?? '';
|
||||
await openEntry({ name: fileName, type: 'file', size: 0 });
|
||||
}
|
||||
} else {
|
||||
if (currentPath.startsWith(dir) || dir.startsWith(currentPath)) {
|
||||
await loadDir(currentPath, { preserveTree: true });
|
||||
} else {
|
||||
if (currentPath.startsWith(dir) || dir.startsWith(currentPath)) {
|
||||
await refreshBrowser();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (!handledDisplayFile && terminal) {
|
||||
loading = true;
|
||||
|
|
|
|||
|
|
@ -33,11 +33,12 @@
|
|||
toolServers,
|
||||
terminalServers,
|
||||
user as _user,
|
||||
showControls,
|
||||
showSettings,
|
||||
selectedTerminalId,
|
||||
TTSWorker,
|
||||
temporaryChatEnabled
|
||||
showControls,
|
||||
showSettings,
|
||||
showFileNavDir,
|
||||
selectedTerminalId,
|
||||
TTSWorker,
|
||||
temporaryChatEnabled
|
||||
} from '$lib/stores';
|
||||
|
||||
import {
|
||||
|
|
@ -942,11 +943,12 @@
|
|||
fileItem.status = 'uploaded';
|
||||
fileItem.id = uploadedFile.path;
|
||||
fileItem.path = uploadedFile.path;
|
||||
fileItem.url = uploadedFile.path;
|
||||
fileItem.size = uploadedFile.size ?? file.size;
|
||||
fileItem.file = uploadedFile;
|
||||
files = files;
|
||||
} else {
|
||||
fileItem.url = uploadedFile.path;
|
||||
fileItem.size = uploadedFile.size ?? file.size;
|
||||
fileItem.file = uploadedFile;
|
||||
files = files;
|
||||
showFileNavDir.set(uploadedFile.path);
|
||||
} else {
|
||||
fileItem.status = 'error';
|
||||
fileItem.error = $i18n.t('Failed to upload file.');
|
||||
toast.error(fileItem.error);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue