mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 21:42:58 +00:00
refac
This commit is contained in:
parent
708d755eda
commit
8bca17ee1d
@ -20,27 +20,23 @@
|
|||||||
let modelfilesImportInputElement: HTMLInputElement;
|
let modelfilesImportInputElement: HTMLInputElement;
|
||||||
|
|
||||||
const deleteModelHandler = async (model) => {
|
const deleteModelHandler = async (model) => {
|
||||||
if (model?.info?.base_model_id) {
|
console.log(model.info);
|
||||||
|
if (!model?.info) {
|
||||||
|
toast.error(
|
||||||
|
$i18n.t('{{ owner }}: You cannot delete a base model', {
|
||||||
|
owner: model.owned_by.toUpperCase()
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const res = await deleteModelById(localStorage.token, model.id);
|
const res = await deleteModelById(localStorage.token, model.id);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
toast.success($i18n.t(`Deleted {{name}}`, { name: model.id }));
|
toast.success($i18n.t(`Deleted {{name}}`, { name: model.id }));
|
||||||
}
|
}
|
||||||
await models.set(await getModels(localStorage.token));
|
|
||||||
} else if (model?.owned_by === 'ollama') {
|
|
||||||
const res = await deleteModel(localStorage.token, model.id);
|
|
||||||
|
|
||||||
if (res) {
|
|
||||||
toast.success($i18n.t(`Deleted {{name}}`, { name: model.id }));
|
|
||||||
}
|
|
||||||
await models.set(await getModels(localStorage.token));
|
await models.set(await getModels(localStorage.token));
|
||||||
} else {
|
|
||||||
toast.error(
|
|
||||||
$i18n.t('{{ owner }}: You cannot delete this model', {
|
|
||||||
owner: model.owned_by.toUpperCase()
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const cloneModelHandler = async (model) => {
|
const cloneModelHandler = async (model) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user