mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-07 08:27:05 +00:00
refac
This commit is contained in:
parent
f1c803d36b
commit
0fa4dea5ff
4 changed files with 18 additions and 4 deletions
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
import logging
|
||||
import urllib.request
|
||||
|
||||
from ddgs import DDGS
|
||||
from open_webui.env import USE_SLIM
|
||||
from open_webui.retrieval.web.main import SearchResult, get_filtered_results
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -26,6 +26,13 @@ def search_duckduckgo(
|
|||
Returns:
|
||||
list[SearchResult]: A list of search results
|
||||
"""
|
||||
if USE_SLIM:
|
||||
raise ValueError(
|
||||
'DDGS is unavailable in slim. Configure another web search provider in Admin Settings > Web Search.'
|
||||
)
|
||||
|
||||
from ddgs import DDGS
|
||||
|
||||
# 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()
|
||||
|
|
|
|||
|
|
@ -951,6 +951,15 @@ async def update_rag_config(request: Request, form_data: ConfigForm, user=Depend
|
|||
# RAG settings
|
||||
config = await get_retrieval_config()
|
||||
if USE_SLIM:
|
||||
if (
|
||||
form_data.web
|
||||
and form_data.web.WEB_SEARCH_ENGINE == 'duckduckgo'
|
||||
and config.WEB_SEARCH_ENGINE != 'duckduckgo'
|
||||
):
|
||||
raise HTTPException(
|
||||
400,
|
||||
'DDGS is unavailable in slim. Configure another web search provider in Admin Settings > Web Search.',
|
||||
)
|
||||
if (
|
||||
form_data.web
|
||||
and form_data.web.WEB_LOADER_ENGINE == 'playwright'
|
||||
|
|
|
|||
|
|
@ -74,8 +74,6 @@ rank-bm25==0.2.2
|
|||
black==26.5.1
|
||||
youtube-transcript-api==1.2.4
|
||||
|
||||
ddgs==9.14.4
|
||||
|
||||
azure-ai-documentintelligence==1.0.2
|
||||
azure-identity==1.25.3
|
||||
azure-search-documents==12.0.0
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@
|
|||
<option disabled selected value="">{$i18n.t('Select a engine')}</option>
|
||||
{#each webSearchEngines as engine}
|
||||
{#if engine === 'duckduckgo' || engine === 'ddgs'}
|
||||
<option value={engine}>DDGS</option>
|
||||
<option value={engine} disabled={$config?.features?.slim}>DDGS</option>
|
||||
{:else if engine === 'serphouse'}
|
||||
<option value={engine}>SERPHouse</option>
|
||||
{:else}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue