From 8bb3eaa32025f5675f5937e46e939caed2518374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E5=A4=A7=E4=BE=A0?= Date: Thu, 18 Sep 2025 17:11:28 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=8E=B7=E5=8F=96=E4=B8=8A=E6=AC=A1?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C=E6=97=B6=E4=BA=A7=E7=94=9F?= =?UTF-8?q?=E7=9A=84NoneType=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glitchtip#14 --- app/api/endpoints/search.py | 2 +- app/chain/search.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/endpoints/search.py b/app/api/endpoints/search.py index ec6a9e90..3854fb9b 100644 --- a/app/api/endpoints/search.py +++ b/app/api/endpoints/search.py @@ -20,7 +20,7 @@ async def search_latest(_: schemas.TokenPayload = Depends(verify_token)) -> Any: """ 查询搜索结果 """ - torrents = await SearchChain().async_last_search_results() + torrents = await SearchChain().async_last_search_results() or [] return [torrent.to_dict() for torrent in torrents] diff --git a/app/chain/search.py b/app/chain/search.py index 2f2f0fe3..dcf46864 100644 --- a/app/chain/search.py +++ b/app/chain/search.py @@ -86,13 +86,13 @@ class SearchChain(ChainBase): self.save_cache(contexts, self.__result_temp_file) return contexts - def last_search_results(self) -> List[Context]: + def last_search_results(self) -> Optional[List[Context]]: """ 获取上次搜索结果 """ return self.load_cache(self.__result_temp_file) - async def async_last_search_results(self) -> List[Context]: + async def async_last_search_results(self) -> Optional[List[Context]]: """ 异步获取上次搜索结果 """