From 14c73b46a2dec1a56b83ffb5fce44b953f05a49f Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Sun, 19 Jul 2026 17:01:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(ts):=20=E4=BF=AE=E5=A4=8D=E9=85=8D=E9=9F=B3?= =?UTF-8?q?=E7=B4=A0=E6=9D=90Tab=E7=9A=84API=E7=B1=BB=E5=9E=8B=E4=B8=8D?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/api/assets.ts | 8 +++++++- apps/web/src/pages/voices/VoiceLibrary.tsx | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/web/src/api/assets.ts b/apps/web/src/api/assets.ts index 8d1f04450..8cb2aa49b 100755 --- a/apps/web/src/api/assets.ts +++ b/apps/web/src/api/assets.ts @@ -184,13 +184,19 @@ export const getAssetsByKind = async ( gender?: string style?: string tag_ids?: string[] + limit?: number + page?: number + page_size?: number }, ): Promise => { - const params: Record = { kind } + const params: Record = { kind } if (filters?.keyword) params.keyword = filters.keyword if (filters?.gender) params.gender = filters.gender if (filters?.style) params.style = filters.style if (filters?.tag_ids?.length) params.tag_ids = filters.tag_ids.join(",") + if (filters?.limit) params.limit = filters.limit + if (filters?.page) params.page = filters.page + if (filters?.page_size) params.page_size = filters.page_size const response = await apiClient.get("/assets", { params }) return response.data.items || [] } diff --git a/apps/web/src/pages/voices/VoiceLibrary.tsx b/apps/web/src/pages/voices/VoiceLibrary.tsx index 034fea8a6..7e3ae0242 100755 --- a/apps/web/src/pages/voices/VoiceLibrary.tsx +++ b/apps/web/src/pages/voices/VoiceLibrary.tsx @@ -826,7 +826,7 @@ const VoiceLibrary: React.FC = () => { ) const presetCount = unifiedStats?.preset_count ?? presetData?.total ?? 0 const cloneCount = unifiedStats?.clone_count ?? cloneData?.total ?? 0 - const materialCount = materialData?.total ?? (materialData?.items?.length || 0) + const materialCount = materialData?.length ?? 0 const filteredPreset = useMemo(() => { let list = presetVoices @@ -1175,9 +1175,9 @@ const VoiceLibrary: React.FC = () => { )} {/* 卡片列表 */} - {!materialLoading && (materialData?.items?.length || 0) > 0 && ( + {!materialLoading && (materialData?.length || 0) > 0 && (
- {(materialData?.items || []).map((asset: AssetItem) => { + {(materialData || []).map((asset: AssetItem) => { const duration = (asset.metadata?.duration as number) || 0 const minutes = Math.floor(duration / 60) const seconds = Math.floor(duration % 60) @@ -1208,7 +1208,7 @@ const VoiceLibrary: React.FC = () => { )} {/* 空状态 */} - {!materialLoading && (materialData?.items?.length || 0) === 0 && ( + {!materialLoading && (materialData?.length || 0) === 0 && (