From 99983583164b6e9e3cc622c8278515fd905856fe Mon Sep 17 00:00:00 2001 From: tpoisonooo Date: Fri, 27 Sep 2024 15:44:08 +0800 Subject: [PATCH] fix(web_search.py): add missing method --- huixiangdou/service/web_search.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/huixiangdou/service/web_search.py b/huixiangdou/service/web_search.py index 0961817f..e3f9f1af 100644 --- a/huixiangdou/service/web_search.py +++ b/huixiangdou/service/web_search.py @@ -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