This commit is contained in:
Timothy Jaeryang Baek
2026-05-20 01:46:59 +04:00
parent 8f2d346e10
commit 1527eb6e01
4 changed files with 47 additions and 5 deletions
@@ -81,6 +81,7 @@
let pendingSyncFiles: Array<{ path: string; filename: string; file: File }> | null = null;
let syncing: string | null = null;
let showAccessControlModal = false;
let showResetConfirm = false;
let minSize = 0;
type Knowledge = {
@@ -1292,8 +1293,11 @@
if (pendingSyncFiles?.length) {
showSyncConfirmModal = true;
}
}}
/>
}}
onReset={() => {
showResetConfirm = true;
}}
/>
</div>
{/if}
</div>
@@ -1528,3 +1532,17 @@
</div>
</div>
</ConfirmDialog>
<ConfirmDialog
bind:show={showResetConfirm}
title={$i18n.t('Reset knowledge base?')}
on:confirm={async () => {
await resetKnowledgeById(localStorage.token, id);
toast.success($i18n.t('Knowledge base has been reset'));
init();
}}
>
<div class="text-sm text-gray-700 dark:text-gray-300 flex-1 line-clamp-3">
{$i18n.t('This will remove all files and directories from this knowledge base. This action cannot be undone.')}
</div>
</ConfirmDialog>
@@ -10,6 +10,8 @@
import NewFolderAlt from '$lib/components/icons/NewFolderAlt.svelte';
import ArrowPath from '$lib/components/icons/ArrowPath.svelte';
import GlobeAlt from '$lib/components/icons/GlobeAlt.svelte';
import GarbageBin from '$lib/components/icons/GarbageBin.svelte';
import ArrowUturnLeft from '$lib/components/icons/ArrowUturnLeft.svelte';
const i18n = getContext('i18n');
@@ -17,6 +19,7 @@
export let onSync: Function = () => {};
export let onUpload: Function = (data) => {};
export let onReset: Function = () => {};
let show = false;
</script>
@@ -124,6 +127,19 @@
<BarsArrowUp strokeWidth="2" />
<div class="flex items-center">{$i18n.t('Add text content')}</div>
</button>
<hr class="my-1 border-gray-100 dark:border-gray-800" />
<button
class="select-none flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
on:click={() => {
onReset();
show = false;
}}
>
<ArrowUturnLeft strokeWidth="2" />
<div class="flex items-center">{$i18n.t('Reset')}</div>
</button>
</div>
</div>
</Dropdown>