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
3cc0e3ec
Unverified
Commit
3cc0e3ec
authored
Jun 17, 2024
by
Que Nguyen
Committed by
GitHub
Jun 17, 2024
Browse files
Refactor rag/main.py
Renamed function get_filtered_results
parent
d8beed13
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
backend/apps/rag/search/main.py
backend/apps/rag/search/main.py
+3
-3
No files found.
backend/apps/rag/search/main.py
View file @
3cc0e3ec
...
...
@@ -3,13 +3,13 @@ from urllib.parse import urlparse
from
pydantic
import
BaseModel
def
filter
_by_whitelist
(
results
,
white
list
):
if
not
white
list
:
def
get_
filter
ed_results
(
results
,
filter_
list
):
if
not
filter_
list
:
return
results
filtered_results
=
[]
for
result
in
results
:
domain
=
urlparse
(
result
[
"url"
]).
netloc
if
any
(
domain
.
endswith
(
whitelist
ed_domain
)
for
whitelist
ed_domain
in
white
list
):
if
any
(
domain
.
endswith
(
filter
ed_domain
)
for
filter
ed_domain
in
filter_
list
):
filtered_results
.
append
(
result
)
return
filtered_results
...
...
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