feat: export kb to zip
This commit is contained in:
1 parent
9b06fdc8fe
commit
c1147578c0
5 files changed
+139
-2
No files matched your search
@@ -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;
|
||||
};
|
||||
Reference in new issue
Block a user