This commit is contained in:
Timothy Jaeryang Baek 2026-09-16 00:02:48 -04:00
parent dfde08aa73
commit 6d8e63e366
6 changed files with 33 additions and 11 deletions

View file

@ -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,

View file

@ -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'),

View file

@ -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,

View file

@ -381,6 +381,20 @@
/>
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Direct Integrations')}
description={$i18n.t(
'Show the Integrations tab for users with permission to manage their own tool and terminal connections, including admins. Hiding it does not disable existing connections.'
)}
let:labelId
>
<Switch
bind:state={connectionsConfig.ENABLE_DIRECT_INTEGRATIONS}
on:change={() => updateConnectionsHandler()}
ariaLabelledbyId={labelId}
/>
</AdminSettingRow>
<AdminSettingRow
label={$i18n.t('Cache Base Model List')}
description={$i18n.t(

View file

@ -1,6 +1,6 @@
<script lang="ts">
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();
});
});
}
</script>
<Modal

View file

@ -359,6 +359,7 @@ type Config = {
enable_plugins?: boolean;
enable_autocomplete_generation: boolean;
enable_direct_connections: boolean;
enable_direct_integrations?: boolean;
enable_version_update_check: boolean;
enable_pyodide_file_persistence?: boolean;
folder_max_file_count?: number;