diff --git a/src/lib/components/workspace/Models/ModelEditor.svelte b/src/lib/components/workspace/Models/ModelEditor.svelte index b184d5d5d..58628f0d1 100644 --- a/src/lib/components/workspace/Models/ModelEditor.svelte +++ b/src/lib/components/workspace/Models/ModelEditor.svelte @@ -45,6 +45,8 @@ let id = ''; let name = ''; + let enableDescription = true; + $: if (!edit) { if (name) { id = name @@ -115,6 +117,12 @@ info.access_control = accessControl; info.meta.capabilities = capabilities; + if (enableDescription) { + info.meta.description = info.meta.description.trim() === '' ? null : info.meta.description; + } else { + info.meta.description = null; + } + if (knowledge.length > 0) { info.meta.knowledge = knowledge; } else { @@ -178,6 +186,8 @@ id = model.id; + enableDescription = model?.meta?.description !== null; + if (model.base_model_id) { const base_model = $models .filter((m) => !m?.preset && !(m?.arena ?? false)) @@ -479,14 +489,10 @@ class="p-1 text-xs flex rounded transition" type="button" on:click={() => { - if (info.meta.description === null) { - info.meta.description = ''; - } else { - info.meta.description = null; - } + enableDescription = !enableDescription; }} > - {#if info.meta.description === null} + {#if !enableDescription} {$i18n.t('Default')} {:else} {$i18n.t('Custom')} @@ -494,17 +500,16 @@ - {#if info.meta.description !== null} + {#if enableDescription}