mirror of
https://github.com/open-webui/open-webui
synced 2025-01-30 22:39:03 +00:00
Refactor rag/main.py
Renamed function get_filtered_results
This commit is contained in:
parent
d8beed13b4
commit
3cc0e3ecb6
@ -3,13 +3,13 @@ from urllib.parse import urlparse
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
def filter_by_whitelist(results, whitelist):
|
||||
if not whitelist:
|
||||
def get_filtered_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(whitelisted_domain) for whitelisted_domain in whitelist):
|
||||
if any(domain.endswith(filtered_domain) for filtered_domain in filter_list):
|
||||
filtered_results.append(result)
|
||||
return filtered_results
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user