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; let modelfilesImportInputElement: HTMLInputElement;
const deleteModelHandler = async (model) => { const deleteModelHandler = async (model) => {
if (model?.info?.base_model_id) { console.log(model.info);
const res = await deleteModelById(localStorage.token, model.id); if (!model?.info) {
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( toast.error(
$i18n.t('{{ owner }}: You cannot delete this model', { $i18n.t('{{ owner }}: You cannot delete a base model', {
owner: model.owned_by.toUpperCase() 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));
}; };
const cloneModelHandler = async (model) => { const cloneModelHandler = async (model) => {