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
83f086cc
Commit
83f086cc
authored
May 06, 2024
by
Jun Siang Cheah
Browse files
fix: do not return raw search exception due to API keys in URLs
parent
99e4edd3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
backend/apps/rag/main.py
backend/apps/rag/main.py
+8
-1
backend/constants.py
backend/constants.py
+4
-0
No files found.
backend/apps/rag/main.py
View file @
83f086cc
...
...
@@ -555,8 +555,15 @@ def resolve_hostname(hostname):
@
app
.
post
(
"/websearch"
)
def
store_websearch
(
form_data
:
SearchForm
,
user
=
Depends
(
get_current_user
)):
try
:
try
:
web_results
=
search_web
(
form_data
.
query
)
except
Exception
as
e
:
log
.
exception
(
e
)
raise
HTTPException
(
status_code
=
status
.
HTTP_400_BAD_REQUEST
,
detail
=
ERROR_MESSAGES
.
WEB_SEARCH_ERROR
,
)
urls
=
[
result
.
link
for
result
in
web_results
]
loader
=
get_web_loader
(
urls
)
data
=
loader
.
load
()
...
...
backend/constants.py
View file @
83f086cc
...
...
@@ -75,3 +75,7 @@ class ERROR_MESSAGES(str, Enum):
INVALID_URL
=
(
"Oops! The URL you provided is invalid. Please double-check and try again."
)
WEB_SEARCH_ERROR
=
(
"Oops! Something went wrong while searching the web. Please try again later."
)
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