From 758e4f6cc3bc504c8e100e535694dbc93214ad31 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sun, 25 Oct 2026 00:35:35 +0200 Subject: [PATCH] fix: built-in tools show while the model's matching capability is off (#32965) * fix: built-in tools show while the model's matching capability is off The Files built-in tool showed in the model editor although a model only gets it while File Upload is on and File Context is off, and File Context is on by default. The Memory, Web Search, Image Generation and Code Interpreter tools also showed while the same capability was off on that model. These tools now appear and disappear as the model's capabilities are switched, and the saved tool choices are kept for when the capability is turned back on. Refs #32830 * refac: filter built-in tools by their capability directly Same behaviour, with the per-tool capability list folded into the filter. * fix: treat unset file capabilities as on when showing the Files tool Matches how the server decides whether a model gets the Files tool. --- src/lib/components/workspace/Models/BuiltinTools.svelte | 8 +++++++- src/lib/components/workspace/Models/Capabilities.svelte | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/components/workspace/Models/BuiltinTools.svelte b/src/lib/components/workspace/Models/BuiltinTools.svelte index c6fc2f4bea..a0209a0f16 100644 --- a/src/lib/components/workspace/Models/BuiltinTools.svelte +++ b/src/lib/components/workspace/Models/BuiltinTools.svelte @@ -79,9 +79,15 @@ } }; - $: allTools = Object.keys(toolLabels ?? {}) as Array; + // with File Context on, attached files go into the prompt instead + $: allTools = (Object.keys(toolLabels ?? {}) as Array).filter((key) => + key === 'files' + ? (capabilities.file_upload ?? true) && !(capabilities.file_context ?? true) + : (capabilities[key] ?? true) + ); export let builtinTools: Record = {}; + export let capabilities: Record = {}; export let disabled = false; $: enabledTools = allTools.filter((key) => builtinTools[key] !== false); diff --git a/src/lib/components/workspace/Models/Capabilities.svelte b/src/lib/components/workspace/Models/Capabilities.svelte index 635ba726a2..478540ef4e 100644 --- a/src/lib/components/workspace/Models/Capabilities.svelte +++ b/src/lib/components/workspace/Models/Capabilities.svelte @@ -162,6 +162,6 @@ {/if} {#if capabilities.builtin_tools} - + {/if}