diff --git a/src/lib/components/workspace/Models/BuiltinTools.svelte b/src/lib/components/workspace/Models/BuiltinTools.svelte index b91626aa94..01754c56b6 100644 --- a/src/lib/components/workspace/Models/BuiltinTools.svelte +++ b/src/lib/components/workspace/Models/BuiltinTools.svelte @@ -78,6 +78,15 @@ const allTools = Object.keys(toolLabels) as Array; export let builtinTools: Record = {}; + + const setBuiltinTool = (tool: keyof typeof toolLabels, checked: boolean) => { + if (checked) { + delete builtinTools[tool]; + } else { + builtinTools[tool] = false; + } + builtinTools = builtinTools; + };
@@ -89,19 +98,22 @@ ariaLabel={$i18n.t(toolLabels[tool].label)} state={builtinTools[tool] !== false ? 'checked' : 'unchecked'} on:change={(e) => { - if (e.detail === 'checked') { - delete builtinTools[tool]; - } else { - builtinTools[tool] = false; - } - builtinTools = builtinTools; + setBuiltinTool(tool, e.detail === 'checked'); }} /> -
- - {$i18n.t(toolLabels[tool].label)} +
+
{/each} diff --git a/src/lib/components/workspace/Models/Capabilities.svelte b/src/lib/components/workspace/Models/Capabilities.svelte index c3db230010..04be7c3939 100644 --- a/src/lib/components/workspace/Models/Capabilities.svelte +++ b/src/lib/components/workspace/Models/Capabilities.svelte @@ -1,10 +1,12 @@
@@ -34,18 +48,22 @@ ariaLabel={$i18n.t(featureLabels[feature].label)} state={featureIds.includes(feature) ? 'checked' : 'unchecked'} on:change={(e) => { - if (e.detail === 'checked') { - featureIds = [...featureIds, feature]; - } else { - featureIds = featureIds.filter((id) => id !== feature); - } + setFeature(feature, e.detail === 'checked'); }} /> -
- - {$i18n.t(featureLabels[feature].label)} +
+
{/each}