From 7edad89199bdb505c2c54adfafa40e31ba7ab657 Mon Sep 17 00:00:00 2001 From: ali asaria Date: Tue, 9 Jan 2024 10:21:01 -0500 Subject: [PATCH] Use delete models endpoint --- src/renderer/components/ModelZoo/LocalModels.tsx | 15 +++++++++++++-- src/renderer/lib/transformerlab-api-sdk.ts | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/ModelZoo/LocalModels.tsx b/src/renderer/components/ModelZoo/LocalModels.tsx index 7faae122..80043c8d 100644 --- a/src/renderer/components/ModelZoo/LocalModels.tsx +++ b/src/renderer/components/ModelZoo/LocalModels.tsx @@ -317,8 +317,19 @@ export default function LocalModels({   { - mutate(); + onClick={async () => { + if ( + confirm( + "Are you sure you want to delete model '" + + row.model_id + + "'?" + ) + ) { + await fetch( + chatAPI.Endpoints.Models.Delete(row.model_id) + ); + mutate(); + } }} /> diff --git a/src/renderer/lib/transformerlab-api-sdk.ts b/src/renderer/lib/transformerlab-api-sdk.ts index 025b8f59..1e684244 100644 --- a/src/renderer/lib/transformerlab-api-sdk.ts +++ b/src/renderer/lib/transformerlab-api-sdk.ts @@ -436,6 +436,7 @@ Endpoints.Models = { ModelDetailsFromGallery: (modelId: string) => API_URL() + 'model/gallery/' + convertSlashInUrl(modelId), HuggingFaceLogin: () => API_URL() + 'model/login_to_huggingface', + Delete: (modelId: string) => API_URL() + 'model/delete?model_id=' + modelId, }; Endpoints.Plugins = {