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.
This commit is contained in:
G30 2026-10-15 19:14:30 -04:00 • committed by GitHub
parent ad3e5a6c42
commit 9cc648cad8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -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;
};
</script>

View file

@ -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) {