This commit is contained in:
Timothy Jaeryang Baek
2026-05-09 06:41:42 +09:00
parent 6700f7bb72
commit bb0e6cb108
2 changed files with 7 additions and 3 deletions

View File

@@ -3287,7 +3287,7 @@ ENABLE_WEB_LOADER_SSL_VERIFICATION = PersistentConfig(
WEB_SEARCH_TRUST_ENV = PersistentConfig( WEB_SEARCH_TRUST_ENV = PersistentConfig(
'WEB_SEARCH_TRUST_ENV', 'WEB_SEARCH_TRUST_ENV',
'rag.web.search.trust_env', 'rag.web.search.trust_env',
os.getenv('WEB_SEARCH_TRUST_ENV', 'False').lower() == 'true', os.getenv('WEB_SEARCH_TRUST_ENV', 'True').lower() == 'true',
) )

View File

@@ -1,4 +1,5 @@
import logging import logging
import urllib.request
from typing import Optional from typing import Optional
from open_webui.retrieval.web.main import SearchResult, get_filtered_results from open_webui.retrieval.web.main import SearchResult, get_filtered_results
@@ -25,9 +26,12 @@ def search_duckduckgo(
Returns: Returns:
list[SearchResult]: A list of search results list[SearchResult]: A list of search results
""" """
# Use the DDGS context manager to create a DDGS object # The ddgs library (primp-based) does not auto-detect proxy env vars.
# Resolve via stdlib getproxies() — same pattern as the other loaders.
env_proxies = urllib.request.getproxies()
proxy = env_proxies.get('https') or env_proxies.get('http')
search_results = [] search_results = []
with DDGS() as ddgs: with DDGS(proxy=proxy) as ddgs:
if concurrent_requests: if concurrent_requests:
ddgs.threads = concurrent_requests ddgs.threads = concurrent_requests