Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
a3ac9ee7
Unverified
Commit
a3ac9ee7
authored
Jun 17, 2024
by
Que Nguyen
Committed by
GitHub
Jun 17, 2024
Browse files
Refactor main.py
Rename RAG_WEB_SEARCH_WHITE_LIST_DOMAINS to RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
parent
75e51ecf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
backend/apps/rag/main.py
backend/apps/rag/main.py
+9
-9
No files found.
backend/apps/rag/main.py
View file @
a3ac9ee7
...
@@ -112,7 +112,7 @@ from config import (
...
@@ -112,7 +112,7 @@ from config import (
YOUTUBE_LOADER_LANGUAGE
,
YOUTUBE_LOADER_LANGUAGE
,
ENABLE_RAG_WEB_SEARCH
,
ENABLE_RAG_WEB_SEARCH
,
RAG_WEB_SEARCH_ENGINE
,
RAG_WEB_SEARCH_ENGINE
,
RAG_WEB_SEARCH_
WHI
TE_LIST
_DOMAINS
,
RAG_WEB_SEARCH_
DOMAIN_FIL
TE
R
_LIST
,
SEARXNG_QUERY_URL
,
SEARXNG_QUERY_URL
,
GOOGLE_PSE_API_KEY
,
GOOGLE_PSE_API_KEY
,
GOOGLE_PSE_ENGINE_ID
,
GOOGLE_PSE_ENGINE_ID
,
...
@@ -166,7 +166,7 @@ app.state.YOUTUBE_LOADER_TRANSLATION = None
...
@@ -166,7 +166,7 @@ app.state.YOUTUBE_LOADER_TRANSLATION = None
app
.
state
.
config
.
ENABLE_RAG_WEB_SEARCH
=
ENABLE_RAG_WEB_SEARCH
app
.
state
.
config
.
ENABLE_RAG_WEB_SEARCH
=
ENABLE_RAG_WEB_SEARCH
app
.
state
.
config
.
RAG_WEB_SEARCH_ENGINE
=
RAG_WEB_SEARCH_ENGINE
app
.
state
.
config
.
RAG_WEB_SEARCH_ENGINE
=
RAG_WEB_SEARCH_ENGINE
app
.
state
.
config
.
RAG_WEB_SEARCH_
WHI
TE_LIST
_DOMAINS
=
RAG_WEB_SEARCH_
WHI
TE_LIST
_DOMAINS
app
.
state
.
config
.
RAG_WEB_SEARCH_
DOMAIN_FIL
TE
R
_LIST
=
RAG_WEB_SEARCH_
DOMAIN_FIL
TE
R
_LIST
app
.
state
.
config
.
SEARXNG_QUERY_URL
=
SEARXNG_QUERY_URL
app
.
state
.
config
.
SEARXNG_QUERY_URL
=
SEARXNG_QUERY_URL
app
.
state
.
config
.
GOOGLE_PSE_API_KEY
=
GOOGLE_PSE_API_KEY
app
.
state
.
config
.
GOOGLE_PSE_API_KEY
=
GOOGLE_PSE_API_KEY
...
@@ -777,7 +777,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
...
@@ -777,7 +777,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
app
.
state
.
config
.
SEARXNG_QUERY_URL
,
app
.
state
.
config
.
SEARXNG_QUERY_URL
,
query
,
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_
WHI
TE_LIST
_DOMAINS
app
.
state
.
config
.
RAG_WEB_SEARCH_
DOMAIN_FIL
TE
R
_LIST
)
)
else
:
else
:
raise
Exception
(
"No SEARXNG_QUERY_URL found in environment variables"
)
raise
Exception
(
"No SEARXNG_QUERY_URL found in environment variables"
)
...
@@ -791,7 +791,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
...
@@ -791,7 +791,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
app
.
state
.
config
.
GOOGLE_PSE_ENGINE_ID
,
app
.
state
.
config
.
GOOGLE_PSE_ENGINE_ID
,
query
,
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_
WHI
TE_LIST
_DOMAINS
app
.
state
.
config
.
RAG_WEB_SEARCH_
DOMAIN_FIL
TE
R
_LIST
)
)
else
:
else
:
raise
Exception
(
raise
Exception
(
...
@@ -803,7 +803,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
...
@@ -803,7 +803,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
app
.
state
.
config
.
BRAVE_SEARCH_API_KEY
,
app
.
state
.
config
.
BRAVE_SEARCH_API_KEY
,
query
,
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_
WHI
TE_LIST
_DOMAINS
app
.
state
.
config
.
RAG_WEB_SEARCH_
DOMAIN_FIL
TE
R
_LIST
)
)
else
:
else
:
raise
Exception
(
"No BRAVE_SEARCH_API_KEY found in environment variables"
)
raise
Exception
(
"No BRAVE_SEARCH_API_KEY found in environment variables"
)
...
@@ -813,7 +813,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
...
@@ -813,7 +813,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
app
.
state
.
config
.
SERPSTACK_API_KEY
,
app
.
state
.
config
.
SERPSTACK_API_KEY
,
query
,
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_
WHI
TE_LIST
_DOMAINS
,
app
.
state
.
config
.
RAG_WEB_SEARCH_
DOMAIN_FIL
TE
R
_LIST
,
https_enabled
=
app
.
state
.
config
.
SERPSTACK_HTTPS
,
https_enabled
=
app
.
state
.
config
.
SERPSTACK_HTTPS
,
)
)
else
:
else
:
...
@@ -824,7 +824,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
...
@@ -824,7 +824,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
app
.
state
.
config
.
SERPER_API_KEY
,
app
.
state
.
config
.
SERPER_API_KEY
,
query
,
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_
WHI
TE_LIST
_DOMAINS
app
.
state
.
config
.
RAG_WEB_SEARCH_
DOMAIN_FIL
TE
R
_LIST
)
)
else
:
else
:
raise
Exception
(
"No SERPER_API_KEY found in environment variables"
)
raise
Exception
(
"No SERPER_API_KEY found in environment variables"
)
...
@@ -834,12 +834,12 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
...
@@ -834,12 +834,12 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
app
.
state
.
config
.
SERPLY_API_KEY
,
app
.
state
.
config
.
SERPLY_API_KEY
,
query
,
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_
WHI
TE_LIST
_DOMAINS
app
.
state
.
config
.
RAG_WEB_SEARCH_
DOMAIN_FIL
TE
R
_LIST
)
)
else
:
else
:
raise
Exception
(
"No SERPLY_API_KEY found in environment variables"
)
raise
Exception
(
"No SERPLY_API_KEY found in environment variables"
)
elif
engine
==
"duckduckgo"
:
elif
engine
==
"duckduckgo"
:
return
search_duckduckgo
(
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_
WHI
TE_LIST
_DOMAINS
)
return
search_duckduckgo
(
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_
DOMAIN_FIL
TE
R
_LIST
)
elif
engine
==
"tavily"
:
elif
engine
==
"tavily"
:
if
app
.
state
.
config
.
TAVILY_API_KEY
:
if
app
.
state
.
config
.
TAVILY_API_KEY
:
return
search_tavily
(
return
search_tavily
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment