Merge pull request #1 from 6drf21e/fix/search1api-key-error

感谢PR!
This commit is contained in:
fatwang2
2024-03-23 19:48:44 +08:00
committed by GitHub
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
<div align="center">
<h1 align="center">Search with Lepton</h1>
<h1 align="center">Search4All</h1>
Build your own conversational search engine using less than 500 lines of code.
<br/>
<a href="https://search2ai.online/website" target="_blank"> Live Demo </a>
+4
View File
@@ -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 []