This commit is contained in:
Timothy Jaeryang Baek
2026-08-11 17:35:05 -06:00
parent 65c3539666
commit 4f9a0ebf71
5 changed files with 192 additions and 44 deletions
+28
View File
@@ -955,6 +955,34 @@ export const reindexKnowledgeFiles = async (token: string) => {
return res;
};
export const reindexKnowledgeMetadata = async (token: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/knowledge/metadata/reindex`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
error = err.detail;
console.error(err);
return null;
});
if (error) {
throw error;
}
return res;
};
export const exportKnowledgeById = async (token: string, id: string) => {
let error = null;
+28
View File
@@ -128,6 +128,34 @@ export const queryMemory = async (token: string, content: string) => {
return res;
};
export const reindexMemoryVectors = async (token: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/memories/reindex`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
error = err.detail;
console.error(err);
return null;
});
if (error) {
throw error;
}
return res;
};
export const deleteMemoryById = async (token: string, id: string) => {
let error = null;
@@ -17,12 +17,13 @@
updateRAGConfig
} from '$lib/apis/retrieval';
import { reindexKnowledgeFiles } from '$lib/apis/knowledge';
import { reindexKnowledgeFiles, reindexKnowledgeMetadata } from '$lib/apis/knowledge';
import { reindexMemoryVectors } from '$lib/apis/memories';
import { deleteAllFiles } from '$lib/apis/files';
import ResetUploadDirConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
import ResetVectorDBConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
import ReindexKnowledgeFilesConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
import ReindexEmbeddingDataConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
import SensitiveInput from '$lib/components/common/SensitiveInput.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import Switch from '$lib/components/common/Switch.svelte';
@@ -371,15 +372,35 @@
}}
/>
<ReindexKnowledgeFilesConfirmDialog
<ReindexEmbeddingDataConfirmDialog
bind:show={showReindexConfirm}
title={$i18n.t('Reindex Embedding Data')}
message={$i18n.t(
'Rebuild knowledge file, knowledge search, and memory vectors using the current embedding model.'
)}
on:confirm={async () => {
const res = await reindexKnowledgeFiles(localStorage.token).catch((error) => {
const knowledgeRes = await reindexKnowledgeFiles(localStorage.token).catch((error) => {
toast.error(`${error}`);
return null;
});
if (!knowledgeRes) {
return;
}
const knowledgeMetadataRes = await reindexKnowledgeMetadata(localStorage.token).catch((error) => {
toast.error(`${error}`);
return null;
});
if (!knowledgeMetadataRes) {
return;
}
const memoryRes = await reindexMemoryVectors(localStorage.token).catch((error) => {
toast.error(`${error}`);
return null;
});
if (res) {
if (memoryRes) {
toast.success($i18n.t('Success'));
}
}}
@@ -1116,7 +1137,7 @@
</div>
<div class="mt-1 text-[0.6875rem] text-gray-400 dark:text-gray-600">
{$i18n.t(
'After changing the embedding model, reindex the knowledge base for changes to take effect.'
'After changing the embedding model, reindex knowledge, knowledge search, and memory vectors for changes to take effect.'
)}
</div>
</AdminSettingField>
@@ -1526,8 +1547,8 @@
</button>
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Reindex Knowledge Base Vectors')}
description={$i18n.t('Rebuild vectors for existing knowledge files.')}
label={$i18n.t('Reindex Knowledge and Memory Vectors')}
description={$i18n.t('Rebuild vectors for existing knowledge files, knowledge search, and memories.')}
>
<button
class={actionButtonClass}