From 1b5a8ac5a77ed6aa49ce737ccb968f79ee3168c7 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Thu, 24 Sep 2026 05:51:57 +0200 Subject: [PATCH] fix: keep model default features when comparing multiple models (#30383) Adding a second model to a chat turned off Web Search, Image Generation and Code Interpreter even when every selected model has them as Default Features, so the comparison ran without them. Changing the selection clears the feature toggles and then reapplies the model defaults, but defaults were only reapplied for a single model. In compare mode a default feature is now turned on when every selected model supports it and has it as a default, since the toggles are shared by all models in the comparison. It only ever turns features on, so flags passed in the URL (?web-search=true) are not overwritten. Single-model defaults are unchanged. The input reset now waits for the model-selection update to finish before applying defaults. Before, the Web Search value actually sent could disagree with the toggle on screen: a single model with Web Search on by default showed the toggle on but sent it off, and switching to a model without it showed it off but still sent it on (see #29326). The toggle and the request now match. Fixes #30310 --- src/lib/components/chat/Chat.svelte | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 5141fed098..8b86efd8dc 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -968,6 +968,8 @@ }; const resetInput = async () => { + // Let the $: update finish first, or webSearchActive misses the default-feature writes + await tick(); selectedToolIds = []; selectedSkillIds = []; selectedFilterIds = []; @@ -1020,6 +1022,41 @@ skills.set(await getSkills(localStorage.token)); } if (selectedModels.length !== 1 && !atSelectedModel) { + const comparedModels = selectedModels + .filter((id) => id) + .map((id) => $models.find((m) => m.id === id)); + const isSharedDefaultFeature = (feature) => + comparedModels.length > 0 && + comparedModels.every( + (model) => + model?.info?.meta?.capabilities?.[feature] && + model?.info?.meta?.defaultFeatureIds?.includes(feature) + ); + + if ( + isSharedDefaultFeature('image_generation') && + $config?.features?.enable_image_generation && + ($user?.role === 'admin' || $user?.permissions?.features?.image_generation) + ) { + imageGenerationEnabled = true; + } + + if ( + isSharedDefaultFeature('web_search') && + $config?.features?.enable_web_search && + ($user?.role === 'admin' || $user?.permissions?.features?.web_search) + ) { + webSearchEnabled = true; + } + + if ( + isSharedDefaultFeature('code_interpreter') && + $config?.features?.enable_code_interpreter && + ($user?.role === 'admin' || $user?.permissions?.features?.code_interpreter) + ) { + codeInterpreterEnabled = true; + } + return; }