feat: export all chats from db

admin only
This commit is contained in:
Timothy J. Baek 2024-02-04 01:07:18 -08:00
parent c4ca46637e
commit 7c2f297c84
4 changed files with 103 additions and 9 deletions

View file

@ -93,6 +93,37 @@ export const getAllChats = async (token: string) => {
return res;
};
export const getAllUserChats = async (token: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/chats/all/db`, {
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
...(token && { authorization: `Bearer ${token}` })
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.then((json) => {
return json;
})
.catch((err) => {
error = err;
console.log(err);
return null;
});
if (error) {
throw error;
}
return res;
};
export const getAllChatTags = async (token: string) => {
let error = null;