mirror of
https://github.com/open-webui/open-webui.git
synced 2026-02-24 04:00:31 +01:00
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.
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user