feat: export kb to zip

This commit is contained in:
Timothy Jaeryang Baek
2026-01-08 12:49:45 +04:00
parent 9b06fdc8fe
commit c1147578c0
5 changed files with 139 additions and 2 deletions
+26
View File
@@ -485,3 +485,29 @@ export const reindexKnowledgeFiles = async (token: string) => {
return res;
};
export const exportKnowledgeById = async (token: string, id: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/knowledge/${id}/export`, {
method: 'GET',
headers: {
authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.blob();
})
.catch((err) => {
error = err.detail;
console.error(err);
return null;
});
if (error) {
throw error;
}
return res;
};