diff --git a/app/services/compute_client.py b/app/services/compute_client.py index 8da21fc..f06887d 100644 --- a/app/services/compute_client.py +++ b/app/services/compute_client.py @@ -134,12 +134,28 @@ async def ensure_user(username: str) -> dict: async def list_models(status: int = 1) -> list[dict]: - """列出引擎 admin 模型(models 表)。返回分页 items 列表。""" - data = await _request( - method="GET", path=f"/api/models?status={status}&p=1&page_size=100", - headers=_admin_headers(), - ) - return (data.get("data") or {}).get("items") or [] + """列出引擎 admin 模型(models 表)。 + + 引擎侧模型按 id 倒序分页(默认 100/页),必须循环取全部分页, + 否则老模型(如 qwen3-asr-flash-2026-02-10 等早期 ASR 模型)会因 + 排在最新 100 条之外而缺失,导致语音转写等模型目录不完整。 + """ + page, page_size = 1, 100 + items: list[dict] = [] + while True: + data = await _request( + method="GET", + path=f"/api/models?status={status}&p={page}&page_size={page_size}", + headers=_admin_headers(), + ) + page_data = data.get("data") or {} + batch = page_data.get("items") or [] + items.extend(batch) + total = int(page_data.get("total") or len(batch) or 0) + if not batch or len(items) >= total or page * page_size >= total: + break + page += 1 + return items async def list_user_tokens(username: str) -> dict: