From 2981caa34bec3a491a71586a0c8e10d068410bf7 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Wed, 29 May 2024 14:05:46 -0700 Subject: [PATCH] fix: import models --- src/lib/components/workspace/Models.svelte | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/components/workspace/Models.svelte b/src/lib/components/workspace/Models.svelte index f37dd5cc3..7c4829e3a 100644 --- a/src/lib/components/workspace/Models.svelte +++ b/src/lib/components/workspace/Models.svelte @@ -307,9 +307,15 @@ for (const model of savedModels) { if (model?.info ?? false) { - await updateModelById(localStorage.token, model.id, model.info).catch((error) => { - return null; - }); + if ($models.find((m) => m.id === model.id)) { + await updateModelById(localStorage.token, model.id, model.info).catch((error) => { + return null; + }); + } else { + await addNewModel(localStorage.token, model.info).catch((error) => { + return null; + }); + } } }