From abfe8687327d2f0e1558fe46af0e335f0a1ae546 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 10 Feb 2025 02:28:01 -0800 Subject: [PATCH] enh: code interpreter global toggle --- backend/open_webui/main.py | 5 +++-- src/lib/components/chat/Chat.svelte | 3 ++- src/lib/components/chat/MessageInput.svelte | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index d9f1408ba..2b741a2bc 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -1040,13 +1040,14 @@ async def get_app_config(request: Request): { "enable_channels": app.state.config.ENABLE_CHANNELS, "enable_web_search": app.state.config.ENABLE_RAG_WEB_SEARCH, - "enable_google_drive_integration": app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION, + "enable_code_interpreter": app.state.config.ENABLE_CODE_INTERPRETER, "enable_image_generation": app.state.config.ENABLE_IMAGE_GENERATION, + "enable_autocomplete_generation": app.state.config.ENABLE_AUTOCOMPLETE_GENERATION, "enable_community_sharing": app.state.config.ENABLE_COMMUNITY_SHARING, "enable_message_rating": app.state.config.ENABLE_MESSAGE_RATING, - "enable_autocomplete_generation": app.state.config.ENABLE_AUTOCOMPLETE_GENERATION, "enable_admin_export": ENABLE_ADMIN_EXPORT, "enable_admin_chat_access": ENABLE_ADMIN_CHAT_ACCESS, + "enable_google_drive_integration": app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION, } if user is not None else {} diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index cc14f2c6f..2348d42fe 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1556,7 +1556,8 @@ ? imageGenerationEnabled : false, code_interpreter: - $user.role === 'admin' || $user?.permissions?.features?.code_interpreter + $config?.features?.enable_code_interpreter && + ($user.role === 'admin' || $user?.permissions?.features?.code_interpreter) ? codeInterpreterEnabled : false, web_search: diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index f9c6786f6..3ab5d05fe 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -1171,7 +1171,7 @@ {/if} - {#if $_user.role === 'admin' || $_user?.permissions?.features?.code_interpreter} + {#if $config?.features?.enable_code_interpreter && ($_user.role === 'admin' || $_user?.permissions?.features?.code_interpreter)}