feat: Add configurable DDGS backend selection with UI support (#20366)
* init * Update WebSearch.svelte * reorder
This commit is contained in:
@@ -13,12 +13,14 @@ def search_duckduckgo(
|
||||
count: int,
|
||||
filter_list: Optional[list[str]] = None,
|
||||
concurrent_requests: Optional[int] = None,
|
||||
backend: Optional[str] = "auto",
|
||||
) -> list[SearchResult]:
|
||||
"""
|
||||
Search using DuckDuckGo's Search API and return the results as a list of SearchResult objects.
|
||||
Args:
|
||||
query (str): The query to search for
|
||||
count (int): The number of results to return
|
||||
backend (str): The search backend to use (auto, duckduckgo, google, brave, etc.)
|
||||
|
||||
Returns:
|
||||
list[SearchResult]: A list of search results
|
||||
@@ -32,7 +34,7 @@ def search_duckduckgo(
|
||||
# Use the ddgs.text() method to perform the search
|
||||
try:
|
||||
search_results = ddgs.text(
|
||||
query, safesearch="moderate", max_results=count, backend="lite"
|
||||
query, safesearch="moderate", max_results=count, backend=backend
|
||||
)
|
||||
except RatelimitException as e:
|
||||
log.error(f"RatelimitException: {e}")
|
||||
|
||||
Reference in New Issue
Block a user