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
This commit is contained in:
Classic298 2026-09-24 05:51:57 +02:00 • committed by GitHub
parent 4e4b324246
commit 1b5a8ac5a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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