mirror of
https://github.com/wahyd4/SAI2.git
synced 2026-08-09 05:06:05 +10:00
Fix format of search results in search_with_search1api function
This commit is contained in:
@@ -124,6 +124,10 @@ def search_with_search1api(query: str, search1api_key: str):
|
||||
json_content = response.json()
|
||||
try:
|
||||
contexts = json_content[:REFERENCE_COUNT]
|
||||
# fix the format
|
||||
for item in contexts:
|
||||
item["name"] = item["title"]
|
||||
item["url"] = item["link"]
|
||||
except KeyError:
|
||||
logger.error(f"Error encountered: {json_content}")
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user