From 6d8e63e3666e1b1aa5540ffda0816be5f40c5271 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 16 Sep 2026 00:02:48 -0400 Subject: [PATCH] refac --- backend/open_webui/config.py | 2 ++ backend/open_webui/main.py | 2 ++ backend/open_webui/routers/configs.py | 4 +++- .../admin/Settings/Connections.svelte | 14 +++++++++++++ src/lib/components/chat/SettingsModal.svelte | 21 ++++++++++--------- src/lib/stores/index.ts | 1 + 6 files changed, 33 insertions(+), 11 deletions(-) diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index 2084fc638a..b475ccbe02 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -228,6 +228,7 @@ if CUSTOM_NAME: #################################### ENABLE_DIRECT_CONNECTIONS = os.getenv('ENABLE_DIRECT_CONNECTIONS', 'False').lower() == 'true' +ENABLE_DIRECT_INTEGRATIONS = os.getenv('ENABLE_DIRECT_INTEGRATIONS', 'False').lower() == 'true' #################################### # OLLAMA_BASE_URL @@ -2840,6 +2841,7 @@ LDAP_ATTRIBUTE_FOR_GROUPS = os.getenv('LDAP_ATTRIBUTE_FOR_GROUPS', 'memberOf') DEFAULT_CONFIG = { 'direct.enable': ENABLE_DIRECT_CONNECTIONS, + 'direct.integrations.enable': ENABLE_DIRECT_INTEGRATIONS, 'ollama.enable': ENABLE_OLLAMA_API, 'ollama.base_urls': OLLAMA_BASE_URLS, 'ollama.api_configs': OLLAMA_API_CONFIGS, diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 162696c369..5ce9aa542c 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -2242,6 +2242,7 @@ async def get_app_config(request: Request): 'auth.enable_api_keys', 'ui.enable_password_change_form', 'direct.enable', + 'direct.integrations.enable', 'folders.enable', 'folders.max_file_count', 'channels.enable', @@ -2328,6 +2329,7 @@ async def get_app_config(request: Request): 'enable_public_active_users_count': ENABLE_PUBLIC_ACTIVE_USERS_COUNT, 'enable_easter_eggs': ENABLE_EASTER_EGGS, 'enable_direct_connections': config.get('direct.enable'), + 'enable_direct_integrations': config.get('direct.integrations.enable', False), 'enable_plugins': ENABLE_PLUGINS, 'enable_folders': config.get('folders.enable'), 'folder_max_file_count': config.get('folders.max_file_count'), diff --git a/backend/open_webui/routers/configs.py b/backend/open_webui/routers/configs.py index d86277c31e..38227dd2fc 100644 --- a/backend/open_webui/routers/configs.py +++ b/backend/open_webui/routers/configs.py @@ -39,6 +39,7 @@ log = logging.getLogger(__name__) CONNECTIONS_CONFIG_KEYS = { 'ENABLE_DIRECT_CONNECTIONS': 'direct.enable', + 'ENABLE_DIRECT_INTEGRATIONS': 'direct.integrations.enable', 'ENABLE_BASE_MODELS_CACHE': 'models.base_models_cache', } CODE_EXECUTION_CONFIG_KEYS = { @@ -131,6 +132,7 @@ async def get_config_namespace(namespace: str, user=Depends(get_admin_user)): class ConnectionsConfigForm(BaseModel): ENABLE_DIRECT_CONNECTIONS: bool + ENABLE_DIRECT_INTEGRATIONS: bool = False ENABLE_BASE_MODELS_CACHE: bool @@ -145,7 +147,7 @@ async def set_connections_config( form_data: ConnectionsConfigForm, user=Depends(get_admin_user), ): - await Config.upsert(config_updates(form_data.model_dump(), CONNECTIONS_CONFIG_KEYS)) + await Config.upsert(config_updates(form_data.model_dump(exclude_unset=True), CONNECTIONS_CONFIG_KEYS)) values = await get_config_values(CONNECTIONS_CONFIG_KEYS) await publish_event( request, diff --git a/src/lib/components/admin/Settings/Connections.svelte b/src/lib/components/admin/Settings/Connections.svelte index fe5278d703..8805f3fb36 100644 --- a/src/lib/components/admin/Settings/Connections.svelte +++ b/src/lib/components/admin/Settings/Connections.svelte @@ -381,6 +381,20 @@ /> + + updateConnectionsHandler()} + ariaLabelledbyId={labelId} + /> + + import { browser } from '$app/environment'; - import { getContext, onMount, tick } from 'svelte'; + import { getContext, tick } from 'svelte'; import type { Writable } from 'svelte/store'; import { toast } from 'svelte-sonner'; import { config, models, settings, user } from '$lib/stores'; @@ -711,6 +711,7 @@ 'api', 'base url', 'direct connections', + 'direct integrations', 'proxy' ] }, @@ -807,8 +808,9 @@ if (tab.id === 'tools') { return ( - $user?.role === 'admin' || - ($user?.role === 'user' && $user?.permissions?.features?.direct_tool_servers) + $config?.features?.enable_direct_integrations === true && + ($user?.role === 'admin' || + ($user?.role === 'user' && $user?.permissions?.features?.direct_tool_servers)) ); } @@ -918,19 +920,18 @@ selectedTab = 'general'; } + $: if (selectedTab === 'tools' && !availableSettings.some((tab) => tab.id === 'tools')) { + selectedTab = 'general'; + } + $: if (modalShow && selectedTab) { scrollToSelectedTab(); } - onMount(() => { + $: if ($config && $user) { availableSettings = getAvailableSettings(); setFilteredSettings(); - - config.subscribe((configData) => { - availableSettings = getAvailableSettings(); - setFilteredSettings(); - }); - }); + }