diff --git a/app/chain/search.py b/app/chain/search.py index 00c8c17f0..a3ee205d4 100644 --- a/app/chain/search.py +++ b/app/chain/search.py @@ -1,4 +1,5 @@ import pickle +import traceback from concurrent.futures import ThreadPoolExecutor, as_completed from datetime import datetime from typing import Dict @@ -88,10 +89,14 @@ def last_search_results(self) -> List[Context]: 获取上次搜索结果 """ # 读取本地文件缓存 - results = self.load_cache(self.__result_temp_file) - if not results: + content = self.load_cache(self.__result_temp_file) + if not content: + return [] + try: + return pickle.loads(content) + except Exception as e: + logger.error(f'加载搜索结果失败:{str(e)} - {traceback.format_exc()}') return [] - return results def process(self, mediainfo: MediaInfo, keyword: str = None,