mirror of
https://github.com/open-webui/open-webui
synced 2025-05-24 06:44:24 +00:00
refac: duckduckgo
This commit is contained in:
parent
38291e9af2
commit
3d0c06ccee
@ -32,19 +32,15 @@ def search_duckduckgo(
|
|||||||
# Convert the search results into a list
|
# Convert the search results into a list
|
||||||
search_results = [r for r in ddgs_gen]
|
search_results = [r for r in ddgs_gen]
|
||||||
|
|
||||||
# Create an empty list to store the SearchResult objects
|
if filter_list:
|
||||||
results = []
|
search_results = get_filtered_results(search_results, filter_list)
|
||||||
# Iterate over each search result
|
|
||||||
for result in search_results:
|
# Return the list of search results
|
||||||
# Create a SearchResult object and append it to the results list
|
return [
|
||||||
results.append(
|
|
||||||
SearchResult(
|
SearchResult(
|
||||||
link=result["href"],
|
link=result["href"],
|
||||||
title=result.get("title"),
|
title=result.get("title"),
|
||||||
snippet=result.get("body"),
|
snippet=result.get("body"),
|
||||||
)
|
)
|
||||||
)
|
for result in search_results
|
||||||
if filter_list:
|
]
|
||||||
results = get_filtered_results(results, filter_list)
|
|
||||||
# Return the list of search results
|
|
||||||
return results
|
|
||||||
|
Loading…
Reference in New Issue
Block a user