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
c0ca4470
Commit
c0ca4470
authored
Jun 12, 2024
by
Timothy J. Baek
Browse files
chore: format
parent
5d3db15e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
backend/apps/rag/main.py
backend/apps/rag/main.py
+2
-1
No files found.
backend/apps/rag/main.py
View file @
c0ca4470
...
@@ -717,7 +717,7 @@ def validate_url(url: Union[str, Sequence[str]]):
...
@@ -717,7 +717,7 @@ def validate_url(url: Union[str, Sequence[str]]):
if
isinstance
(
validators
.
url
(
url
),
validators
.
ValidationError
):
if
isinstance
(
validators
.
url
(
url
),
validators
.
ValidationError
):
raise
ValueError
(
ERROR_MESSAGES
.
INVALID_URL
)
raise
ValueError
(
ERROR_MESSAGES
.
INVALID_URL
)
if
not
ENABLE_RAG_LOCAL_WEB_FETCH
:
if
not
ENABLE_RAG_LOCAL_WEB_FETCH
:
# Check if the URL exists by making a HEAD request
# Check if the URL exists by making a HEAD request
try
:
try
:
response
=
requests
.
head
(
url
,
allow_redirects
=
True
)
response
=
requests
.
head
(
url
,
allow_redirects
=
True
)
if
response
.
status_code
!=
200
:
if
response
.
status_code
!=
200
:
...
@@ -730,6 +730,7 @@ def validate_url(url: Union[str, Sequence[str]]):
...
@@ -730,6 +730,7 @@ def validate_url(url: Union[str, Sequence[str]]):
else
:
else
:
return
False
return
False
def
search_web
(
engine
:
str
,
query
:
str
)
->
list
[
SearchResult
]:
def
search_web
(
engine
:
str
,
query
:
str
)
->
list
[
SearchResult
]:
"""Search the web using a search engine and return the results as a list of SearchResult objects.
"""Search the web using a search engine and return the results as a list of SearchResult objects.
Will look for a search engine API key in environment variables in the following order:
Will look for a search engine API key in environment variables in the following order:
...
...
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