This commit is contained in:
Timothy J. Baek 2024-05-24 18:32:48 -07:00
parent 708d755eda
commit 8bca17ee1d

View File

@ -20,27 +20,23 @@
let modelfilesImportInputElement: HTMLInputElement;
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);
if (res) {
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));
} else {
toast.error(
$i18n.t('{{ owner }}: You cannot delete this model', {
owner: model.owned_by.toUpperCase()
})
);
}
};
const cloneModelHandler = async (model) => {