feat: reset vectordb storage support

This commit is contained in:
Timothy J. Baek 2024-01-07 09:15:45 -08:00
parent d4b2578f6e
commit b37b157638
3 changed files with 63 additions and 2 deletions

View file

@ -103,3 +103,29 @@ export const queryVectorDB = async (
return res;
};
export const resetVectorDB = async (token: string) => {
let error = null;
const res = await fetch(`${RAG_API_BASE_URL}/reset`, {
method: 'GET',
headers: {
Accept: 'application/json',
authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
error = err.detail;
return null;
});
if (error) {
throw error;
}
return res;
};