From b5bd8704fe1672da839bb3be6210d7cb494797ce Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 20 Dec 2025 17:24:24 +0400 Subject: [PATCH] fix: bocha filter list Co-Authored-By: zengxy <11961641+zengxy@users.noreply.github.com> --- backend/open_webui/retrieval/web/bocha.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/open_webui/retrieval/web/bocha.py b/backend/open_webui/retrieval/web/bocha.py index 8dbf077e94..7e3c9b0a40 100644 --- a/backend/open_webui/retrieval/web/bocha.py +++ b/backend/open_webui/retrieval/web/bocha.py @@ -9,13 +9,13 @@ log = logging.getLogger(__name__) def _parse_response(response): - result = {} + results = [] if "data" in response: data = response["data"] if "webPages" in data: webPages = data["webPages"] if "value" in webPages: - result["webpage"] = [ + results = [ { "id": item.get("id", ""), "name": item.get("name", ""), @@ -29,7 +29,7 @@ def _parse_response(response): } for item in webPages["value"] ] - return result + return results def search_bocha( @@ -51,7 +51,7 @@ def search_bocha( response = requests.post(url, headers=headers, data=payload, timeout=5) response.raise_for_status() results = _parse_response(response.json()) - print(results) + if filter_list: results = get_filtered_results(results, filter_list) @@ -59,5 +59,5 @@ def search_bocha( SearchResult( link=result["url"], title=result.get("name"), snippet=result.get("summary") ) - for result in results.get("webpage", [])[:count] + for result in results[:count] ]