diff --git a/.env.example b/.env.example index 5ca052422d..4ede4652bd 100644 --- a/.env.example +++ b/.env.example @@ -24,6 +24,10 @@ ENABLE_MEMORY_SYSTEM_CONTEXT=true # Set to true to add compact row/column stats to parsed CSV retrieval context. ENABLE_RAG_CSV_SUMMARY=false +# Opt in to automatic sending of URL-provided prompts (including links from other sites). +# Defaults to prefill only; enabling this requires a backend restart. +ENABLE_URL_QUERY_SUBMISSION=false + # Set to true to preserve backing file records, storage blobs, and per-file vectors when files are removed from knowledge bases. ENABLE_KNOWLEDGE_FILE_RETENTION=false diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index 7b4fb5a9a0..bfacfed5c6 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -1742,6 +1742,8 @@ RESPONSE_WATERMARK = os.getenv('RESPONSE_WATERMARK', '') IFRAME_CSP = os.getenv('IFRAME_CSP', '') +ENABLE_URL_QUERY_SUBMISSION = os.getenv('ENABLE_URL_QUERY_SUBMISSION', 'False').lower() == 'true' + USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS = ( os.getenv('USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS', 'False').lower() == 'true' ) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 0ed3d753ea..17f6077e69 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -53,6 +53,7 @@ from open_webui.config import ( ENABLE_ADMIN_EXPORT, ENABLE_ONEDRIVE_BUSINESS, ENABLE_ONEDRIVE_PERSONAL, + ENABLE_URL_QUERY_SUBMISSION, # OpenAI ENV, FRONTEND_BUILD_DIR, @@ -2393,6 +2394,7 @@ async def get_app_config(request: Request): 'enable_code_interpreter': config.get('code_interpreter.enable'), 'enable_image_generation': config.get('image_generation.enable'), 'enable_autocomplete_generation': config.get('task.autocomplete.enable'), + 'enable_url_query_submission': ENABLE_URL_QUERY_SUBMISSION, 'enable_community_sharing': config.get('ui.enable_community_sharing'), 'enable_message_rating': config.get('ui.enable_message_rating'), 'enable_user_webhooks': config.get('ui.enable_user_webhooks'), diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index e69924f807..0f0464be8d 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -2622,7 +2622,10 @@ } else if ($page.url.searchParams.get('q')) { const q = $page.url.searchParams.get('q') ?? ''; - if (($page.url.searchParams.get('submit') ?? 'true') === 'true') { + if ( + $config?.features?.enable_url_query_submission && + ($page.url.searchParams.get('submit') ?? 'true') === 'true' + ) { messageInput?.setText(q, () => submitHandler(prompt)); } else { messageInput?.setText(q); diff --git a/src/lib/stores/index.ts b/src/lib/stores/index.ts index e78e11bcef..4742b2c116 100644 --- a/src/lib/stores/index.ts +++ b/src/lib/stores/index.ts @@ -382,6 +382,7 @@ type Config = { enable_functions?: boolean; enable_tool_servers?: boolean; enable_autocomplete_generation: boolean; + enable_url_query_submission?: boolean; enable_direct_connections: boolean; enable_direct_integrations?: boolean; enable_version_update_check: boolean; diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index dd50e9a173..c889671499 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -284,6 +284,7 @@ terminalServers.set([]); }); if ( + $config?.features?.enable_url_query_submission && $page.url.searchParams.get('q') && ($page.url.searchParams.get('submit') ?? 'true') === 'true' ) {