mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-18 05:05:09 +02:00
refac
This commit is contained in:
@@ -3287,7 +3287,7 @@ ENABLE_WEB_LOADER_SSL_VERIFICATION = PersistentConfig(
|
||||
WEB_SEARCH_TRUST_ENV = PersistentConfig(
|
||||
'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',
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import urllib.request
|
||||
from typing import Optional
|
||||
|
||||
from open_webui.retrieval.web.main import SearchResult, get_filtered_results
|
||||
@@ -25,9 +26,12 @@ def search_duckduckgo(
|
||||
Returns:
|
||||
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 = []
|
||||
with DDGS() as ddgs:
|
||||
with DDGS(proxy=proxy) as ddgs:
|
||||
if concurrent_requests:
|
||||
ddgs.threads = concurrent_requests
|
||||
|
||||
|
||||
Reference in New Issue
Block a user