From 140d3c7e671bea084ed1ca618cda58be4823dcdd Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Aug 2026 14:09:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(assets):=20useSmartMatch=20=E5=85=9C?= =?UTF-8?q?=E5=BA=95=E8=BF=87=E6=BB=A4=E7=A9=BA=20id=20=E7=B4=A0=E6=9D=90?= =?UTF-8?q?=EF=BC=88AI=20Review=20=E5=BB=BA=E8=AE=AE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/generate/hooks/step2-materials/useSmartMatch.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/web/src/pages/generate/hooks/step2-materials/useSmartMatch.ts b/apps/web/src/pages/generate/hooks/step2-materials/useSmartMatch.ts index 736181ed1..e297b4626 100755 --- a/apps/web/src/pages/generate/hooks/step2-materials/useSmartMatch.ts +++ b/apps/web/src/pages/generate/hooks/step2-materials/useSmartMatch.ts @@ -69,7 +69,8 @@ export function useSmartMatch({ // 调用后端智能匹配 API(后端也会排除已用尽素材,这里前端兜底过滤) const result = await smartMatchAssets(libraryId, limit) - const matched = (result.items ?? []).filter(isAssetUsable) + // 兜底过滤:id 为空或不可用的素材不参与匹配(smartMatchAssets 已做归一化,这里双保险) + const matched = (result.items ?? []).filter((a) => !!a?.id && isAssetUsable(a)) const matchedIds = matched.map((a: AssetItem) => a.id) if (matchedIds.length > 0) {