From 475e09be458ba61d7bdec836fed11d5f74ab404f Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 1 Jun 2024 15:29:47 -0700 Subject: [PATCH] fix: model params --- src/routes/(app)/workspace/models/create/+page.svelte | 6 ++++++ src/routes/(app)/workspace/models/edit/+page.svelte | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/routes/(app)/workspace/models/create/+page.svelte b/src/routes/(app)/workspace/models/create/+page.svelte index fb3823796..99344b0e6 100644 --- a/src/routes/(app)/workspace/models/create/+page.svelte +++ b/src/routes/(app)/workspace/models/create/+page.svelte @@ -79,6 +79,12 @@ info.meta.capabilities = capabilities; info.params.stop = params.stop ? params.stop.split(',').filter((s) => s.trim()) : null; + Object.keys(info.params).forEach((key) => { + if (info.params[key] === '' || info.params[key] === null) { + delete info.params[key]; + } + }); + if ($models.find((m) => m.id === info.id)) { toast.error( `Error: A model with the ID '${info.id}' already exists. Please select a different ID to proceed.` diff --git a/src/routes/(app)/workspace/models/edit/+page.svelte b/src/routes/(app)/workspace/models/edit/+page.svelte index 526271d46..56a0ad387 100644 --- a/src/routes/(app)/workspace/models/edit/+page.svelte +++ b/src/routes/(app)/workspace/models/edit/+page.svelte @@ -67,6 +67,12 @@ info.meta.capabilities = capabilities; info.params.stop = params.stop ? params.stop.split(',').filter((s) => s.trim()) : null; + Object.keys(info.params).forEach((key) => { + if (info.params[key] === '' || info.params[key] === null) { + delete info.params[key]; + } + }); + const res = await updateModelById(localStorage.token, info.id, info); if (res) {