From 18c984c0721cbda5ef9a8ca4ca26408e81fa1fc8 Mon Sep 17 00:00:00 2001 From: sokouu87 <160479016+sokouu87@users.noreply.github.com> Date: Sat, 29 Aug 2026 12:20:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E7=B2=BE=E7=A1=AE?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E4=B8=8E=E6=A8=A1=E7=B3=8A=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=9A=84=20response=5Fmodel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /search/media/{media_id} 与 /search/title 的 response_model 声明为 Response[list[TorrentInfo]],而 SearchChain.async_search_by_id 与 async_search_by_title 实际返回的是 List[Context]。 Context.to_dict() 产出 {meta_info, media_info, torrent_info} 三层结构, 与 TorrentInfo 的字段完全不相交,被 pydantic 按 response_model 序列化后 所有字段都变成 null,接口对外返回一批空壳数据。 改为与同文件 /search/last 一致的 List[_SchemaContext], 由 ResponseAPIRouter 统一包装成 Response[List[Context]]。 --- app/api/endpoints/search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/endpoints/search.py b/app/api/endpoints/search.py index 2c4128688..bd65fba7c 100644 --- a/app/api/endpoints/search.py +++ b/app/api/endpoints/search.py @@ -432,7 +432,7 @@ async def search_by_id_stream( @router.get( "/media/{media_id}", summary="精确搜索资源", - response_model=_SchemaResponse[list[_SchemaTorrentInfo]], + response_model=List[_SchemaContext], ) async def search_by_id( media_id: str, @@ -513,7 +513,7 @@ async def search_by_title_stream( @router.get( "/title", summary="模糊搜索资源", - response_model=_SchemaResponse[list[_SchemaTorrentInfo]], + response_model=List[_SchemaContext], ) async def search_by_title( keyword: Optional[str] = None,