fix(api): 修复LLM manage端点目录查询返回列表无法透过Dict响应模型校验导致设置页500

This commit is contained in:
jxxghp
2026-08-16 08:27:21 +08:00
parent cd5b85eb6c
commit 98276a68a8
3 changed files with 35 additions and 2 deletions
+4 -2
View File
@@ -1,4 +1,4 @@
from typing import Any, Dict, Optional
from typing import Any, Dict, List, Optional, Union
from fastapi import Depends, Request, Response
from fastapi.responses import HTMLResponse
@@ -15,7 +15,9 @@ router = ResponseAPIRouter()
@router.post(
"/manage",
summary="LLM提供商统一管理",
response_model=schemas.Response[Dict[str, Any]],
# 各动作 data 形态不一:目录查询返回列表,其余动作返回映射,
# 须用具体联合类型声明,而非单一开放映射
response_model=schemas.Response[Union[List[Dict[str, Any]], Dict[str, Any]]],
)
async def manage_provider(
request: Request,