feat: clear memory

This commit is contained in:
Timothy J. Baek
2024-05-19 09:26:24 -07:00
parent 8f83f51c68
commit 6139d775ef
4 changed files with 75 additions and 5 deletions

View File

@@ -121,3 +121,35 @@ export const deleteMemoryById = async (token: string, id: string) => {
return res;
};
export const deleteMemoriesByUserId = async (token: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/memories/user`, {
method: 'DELETE',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.then((json) => {
return json;
})
.catch((err) => {
error = err.detail;
console.log(err);
return null;
});
if (error) {
throw error;
}
return res;
};