Skip to content

Commit

Permalink
fix(web_search.py): add missing method
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisonooo committed Sep 27, 2024
1 parent b2e4f6d commit 9998358
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions huixiangdou/service/web_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,16 @@ def __init__(self, config_path: str, retry: int = 1, language:str='zh') -> None:
with open(config_path, encoding='utf8') as f:
config = pytoml.load(f)
self.search_config = types.SimpleNamespace(**config['web_search'])

self.retry = retry
self.language = language

def load_key():
try:
return self.search_config.serper_x_api_key
except Exception as e:
return ''

def fetch_url(self, query: str, target_link: str, brief: str = ''):
if not target_link.startswith('http'):
return None
Expand Down

0 comments on commit 9998358

Please sign in to comment.