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
25457c625c
commit
186cd4bfa6
2 changed files with 14 additions and 7 deletions
|
|
@ -1,4 +1,7 @@
|
|||
<script context="module">
|
||||
// Keep keys in nested template expressions visible to i18next-parser.
|
||||
// $i18n.t("Unknown error");
|
||||
|
||||
// Persists across mount/unmount cycles (module-level, not per-instance)
|
||||
let savedPath = '/';
|
||||
let savedFileRoot = null;
|
||||
|
|
@ -1145,7 +1148,7 @@
|
|||
chatId ?? undefined
|
||||
);
|
||||
toast[result ? 'success' : 'error'](
|
||||
$i18n.t(result ? 'Folder created' : 'Failed to create folder')
|
||||
result ? $i18n.t('Folder created') : $i18n.t('Failed to create folder')
|
||||
);
|
||||
invalidateTreeCache(currentPath);
|
||||
await loadDir(currentPath, { preserveTree: true });
|
||||
|
|
@ -1171,7 +1174,9 @@
|
|||
|
||||
const emptyFile = new File([''], name, { type: 'application/octet-stream' });
|
||||
const result = await uploadToTerminal(terminal.url, terminal.key, currentPath, emptyFile);
|
||||
toast[result ? 'success' : 'error']($i18n.t(result ? 'File created' : 'Failed to create file'));
|
||||
toast[result ? 'success' : 'error'](
|
||||
result ? $i18n.t('File created') : $i18n.t('Failed to create file')
|
||||
);
|
||||
invalidateTreeCache(currentPath);
|
||||
await loadDir(currentPath, { preserveTree: true });
|
||||
};
|
||||
|
|
@ -1183,7 +1188,9 @@
|
|||
|
||||
const result = await deleteEntry(terminal.url, terminal.key, path, chatId ?? undefined);
|
||||
toast[result ? 'success' : 'error'](
|
||||
$i18n.t(result ? '{{name}} deleted' : 'Failed to delete {{name}}', { name })
|
||||
result
|
||||
? $i18n.t('{{name}} deleted', { name })
|
||||
: $i18n.t('Failed to delete {{name}}', { name })
|
||||
);
|
||||
invalidateTreeCache(currentPath, path);
|
||||
await loadDir(currentPath, { preserveTree: true });
|
||||
|
|
@ -1872,7 +1879,7 @@
|
|||
const file = new File([content], fileName, { type: 'text/plain' });
|
||||
const result = await uploadToTerminal(terminal.url, terminal.key, dir, file);
|
||||
toast[result ? 'success' : 'error'](
|
||||
$i18n.t(result ? 'File saved' : 'Failed to save file')
|
||||
result ? $i18n.t('File saved') : $i18n.t('Failed to save file')
|
||||
);
|
||||
if (result) fileContent = content;
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@
|
|||
strokeWidth={1.4}
|
||||
/>
|
||||
<span class="flex-1 text-left"
|
||||
>{$i18n.t(value === 'unified' ? 'Unified' : 'Split')}</span
|
||||
>{value === 'unified' ? $i18n.t('Unified') : $i18n.t('Split')}</span
|
||||
>
|
||||
{#if mode === value}<Icon name="check" size={12} strokeWidth={1.4} />{/if}
|
||||
</button>
|
||||
|
|
@ -212,9 +212,9 @@
|
|||
</Dropdown>
|
||||
</div>
|
||||
<div class="grid shrink-0 grid-cols-2 border-b border-black/5 dark:border-white/5">
|
||||
{#each [{ label: 'Original', path: original }, { label: 'Revised', path: revised }] as file}
|
||||
{#each [{ label: $i18n.t('Original'), path: original }, { label: $i18n.t('Revised'), path: revised }] as file}
|
||||
<div class="min-w-0 px-3 py-2" title={file.path}>
|
||||
<div class="text-[0.916667em] text-gray-400 dark:text-gray-500">{$i18n.t(file.label)}</div>
|
||||
<div class="text-[0.916667em] text-gray-400 dark:text-gray-500">{file.label}</div>
|
||||
<div class="truncate font-normal text-gray-700 dark:text-gray-300">{name(file.path)}</div>
|
||||
</div>
|
||||
{/each}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue