瀏覽代碼

feat: added Trust Proxy Environment switch in Web Search admin settings tab.

Co-Authored-By: harry zhou <67385896+harryzhou2000@users.noreply.github.com>
Timothy Jaeryang Baek 2 月之前
父節點
當前提交
b14e75dd6c
共有 2 個文件被更改,包括 14 次插入0 次删除
  1. 1 0
      backend/open_webui/routers/retrieval.py
  2. 13 0
      src/lib/components/admin/Settings/WebSearch.svelte

+ 1 - 0
backend/open_webui/routers/retrieval.py

@@ -403,6 +403,7 @@ async def get_rag_config(request: Request, user=Depends(get_admin_user)):
                 "bing_search_v7_subscription_key": request.app.state.config.BING_SEARCH_V7_SUBSCRIPTION_KEY,
                 "exa_api_key": request.app.state.config.EXA_API_KEY,
                 "result_count": request.app.state.config.RAG_WEB_SEARCH_RESULT_COUNT,
+                "trust_env": request.app.state.config.RAG_WEB_SEARCH_TRUST_ENV,
                 "concurrent_requests": request.app.state.config.RAG_WEB_SEARCH_CONCURRENT_REQUESTS,
                 "domain_filter_list": request.app.state.config.RAG_WEB_SEARCH_DOMAIN_FILTER_LIST,
             },

+ 13 - 0
src/lib/components/admin/Settings/WebSearch.svelte

@@ -130,6 +130,19 @@
 					</div>
 				</div>
 
+				<div class=" py-0.5 flex w-full justify-between">
+					<div class=" self-center text-xs font-medium">{$i18n.t('Trust Proxy Environment')}</div>
+					<div class="flex items-center relative">
+						<Tooltip
+							content={webConfig.search.trust_env
+								? 'Use proxy designated by http_proxy and https_proxy environment variables to fetch page contents'
+								: 'Use no proxy to fetch page contents.'}
+						>
+							<Switch bind:state={webConfig.search.trust_env} />
+						</Tooltip>
+					</div>
+				</div>
+
 				{#if webConfig.search.engine !== ''}
 					<div class="mt-1.5">
 						{#if webConfig.search.engine === 'searxng'}