mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
feat: add new admin func - reindex knowledge files
This commit is contained in:
@@ -13,14 +13,12 @@
|
||||
updateEmbeddingConfig,
|
||||
getRerankingConfig,
|
||||
updateRerankingConfig,
|
||||
resetUploadDir,
|
||||
getRAGConfig,
|
||||
updateRAGConfig
|
||||
} from '$lib/apis/retrieval';
|
||||
|
||||
import { knowledge, models } from '$lib/stores';
|
||||
import { getKnowledgeBases } from '$lib/apis/knowledge';
|
||||
import { uploadDir, deleteAllFiles, deleteFileById } from '$lib/apis/files';
|
||||
import { reindexKnowledgeFiles} from '$lib/apis/knowledge';
|
||||
import { deleteAllFiles } from '$lib/apis/files';
|
||||
|
||||
import ResetUploadDirConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
||||
import ResetVectorDBConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
||||
@@ -31,12 +29,12 @@
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
let scanDirLoading = false;
|
||||
let updateEmbeddingModelLoading = false;
|
||||
let updateRerankingModelLoading = false;
|
||||
|
||||
let showResetConfirm = false;
|
||||
let showResetUploadDirConfirm = false;
|
||||
let showReindexConfirm = false;
|
||||
|
||||
let embeddingEngine = '';
|
||||
let embeddingModel = '';
|
||||
@@ -333,6 +331,21 @@
|
||||
}}
|
||||
/>
|
||||
|
||||
|
||||
<ResetVectorDBConfirmDialog
|
||||
bind:show={showReindexConfirm}
|
||||
on:confirm={async () => {
|
||||
const res = await reindexKnowledgeFiles(localStorage.token).catch((error) => {
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
toast.success($i18n.t('Success'));
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
<form
|
||||
class="flex flex-col h-full justify-between space-y-3 text-sm"
|
||||
on:submit|preventDefault={() => {
|
||||
@@ -950,6 +963,21 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" mb-2.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs font-medium">
|
||||
{$i18n.t('Reindex Knowledge Base Vectors')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<button
|
||||
class="text-xs"
|
||||
on:click={() => {
|
||||
showReindexConfirm = true;
|
||||
}}
|
||||
>
|
||||
{$i18n.t('Reindex')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user