enh: reset models

This commit is contained in:
Timothy Jaeryang Baek
2024-11-19 11:03:36 -08:00
parent d76e1319ff
commit 81bb2750e0
5 changed files with 92 additions and 5 deletions
+33
View File
@@ -231,3 +231,36 @@ export const deleteModelById = async (token: string, id: string) => {
return res;
};
export const deleteAllModels = async (token: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/models/delete/all`, {
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;
console.log(err);
return null;
});
if (error) {
throw error;
}
return res;
};