From 9cc648cad8589686e617e4a64bea10134ff16288 Mon Sep 17 00:00:00 2001 From: G30 <50341825+silentoplayz@users.noreply.github.com> Date: Thu, 15 Oct 2026 19:14:30 -0400 Subject: [PATCH] fix: a built-in tool a model turns back on stays on (#32504) When Admin Settings > Models > Model Defaults turns a built-in tool off, a model that turns it back on lost that choice on Save. The editor seeds the model's builtinTools with the admin defaults object itself, and setBuiltinTool deleted the tool's key in place, so the admin defaults changed too. The empty map was then dropped on save, and the backend filled in the admin default again. Update a copy of the map in setBuiltinTool, as the Default Features toggles in Capabilities.svelte already build a new list, and keep the empty map when the admin default is not empty, so the model's choice is stored and overrides it. --- src/lib/components/workspace/Models/BuiltinTools.svelte | 2 +- src/lib/components/workspace/Models/ModelEditor.svelte | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/components/workspace/Models/BuiltinTools.svelte b/src/lib/components/workspace/Models/BuiltinTools.svelte index 63bb56bb5c..c6fc2f4bea 100644 --- a/src/lib/components/workspace/Models/BuiltinTools.svelte +++ b/src/lib/components/workspace/Models/BuiltinTools.svelte @@ -86,12 +86,12 @@ $: enabledTools = allTools.filter((key) => builtinTools[key] !== false); const setBuiltinTool = (tool: keyof typeof toolLabels, checked: boolean) => { + builtinTools = { ...builtinTools }; if (checked) { delete builtinTools[tool]; } else { builtinTools[tool] = false; } - builtinTools = builtinTools; }; diff --git a/src/lib/components/workspace/Models/ModelEditor.svelte b/src/lib/components/workspace/Models/ModelEditor.svelte index 3485504a64..5c9237ee68 100644 --- a/src/lib/components/workspace/Models/ModelEditor.svelte +++ b/src/lib/components/workspace/Models/ModelEditor.svelte @@ -458,7 +458,10 @@ } } - if (Object.keys(builtinTools).length > 0) { + if ( + Object.keys(builtinTools).length > 0 || + Object.keys(defaultMeta.builtinTools ?? {}).length > 0 + ) { modelInfo.meta.builtinTools = builtinTools; } else { if (modelInfo.meta.builtinTools) {