mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-18 04:43:55 +00:00
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:
parent
ad3e5a6c42
commit
9cc648cad8
2 changed files with 5 additions and 2 deletions
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue