feat: add new admin func - reindex knowledge files

This commit is contained in:
hurxxxx
2025-04-08 00:44:10 +09:00
parent 63533c9e3a
commit 4e545d432b
3 changed files with 131 additions and 5 deletions

View File

@@ -345,3 +345,32 @@ export const deleteKnowledgeById = async (token: string, id: string) => {
return res;
};
export const reindexKnowledgeFiles = async (token: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/knowledge/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.log(err);
return null;
});
if (error) {
throw error;
}
return res;
};