From 4228bf71c45cce42208288d34f0e525cdbb63b08 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sat, 21 Feb 2026 20:54:47 +0100 Subject: [PATCH] fix: gate model default features on global config and user permissions (#21690) fix: gate model default features on global config and user permissions If you disabled code interpreter globally and in user permissions but enabled it as a default feature on a model, the code interpreter pill still appeared in the chat input. Same issue for web search and image generation. The setDefaults function in Chat.svelte activated model default features based solely on the model's capability flag, ignoring whether the feature was globally enabled or allowed by user permissions. Added the same global config and user permission checks already used by the integrations menu visibility and the features object sent to the backend. --- src/lib/components/chat/Chat.svelte | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 06b63b074d..9a58a89490 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -329,15 +329,27 @@ // Set Default Features if (model?.info?.meta?.defaultFeatureIds) { - if (model.info?.meta?.capabilities?.['image_generation']) { + if ( + model.info?.meta?.capabilities?.['image_generation'] && + $config?.features?.enable_image_generation && + ($user?.role === 'admin' || $user?.permissions?.features?.image_generation) + ) { imageGenerationEnabled = model.info.meta.defaultFeatureIds.includes('image_generation'); } - if (model.info?.meta?.capabilities?.['web_search']) { + if ( + model.info?.meta?.capabilities?.['web_search'] && + $config?.features?.enable_web_search && + ($user?.role === 'admin' || $user?.permissions?.features?.web_search) + ) { webSearchEnabled = model.info.meta.defaultFeatureIds.includes('web_search'); } - if (model.info?.meta?.capabilities?.['code_interpreter']) { + if ( + model.info?.meta?.capabilities?.['code_interpreter'] && + $config?.features?.enable_code_interpreter && + ($user?.role === 'admin' || $user?.permissions?.features?.code_interpreter) + ) { codeInterpreterEnabled = model.info.meta.defaultFeatureIds.includes('code_interpreter'); } }