From 857926403a8289d7b43cce7e8e2fae9605b99afc Mon Sep 17 00:00:00 2001 From: Steven Su Date: Sun, 4 Feb 2024 22:09:05 +0800 Subject: [PATCH] fix issue#47 --- search_with_lepton.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/search_with_lepton.py b/search_with_lepton.py index 75c9ee2..3c494f4 100644 --- a/search_with_lepton.py +++ b/search_with_lepton.py @@ -3,6 +3,7 @@ import json import os import re +import uuid import threading import requests import traceback @@ -136,6 +137,10 @@ def search_with_google(query: str, subscription_key: str, cx: str): json_content = response.json() try: contexts = json_content["items"][:REFERENCE_COUNT] + for item in contexts: + item['url']=item['link'] + item['name']=item['title'] + item['id']=str(uuid.uuid4()) except KeyError: logger.error(f"Error encountered: {json_content}") return []