diff --git a/components/agents/AgentGenerationWorkspaceDarkV2.tsx b/components/agents/AgentGenerationWorkspaceDarkV2.tsx index c059bfa9a..0cf6150a1 100644 --- a/components/agents/AgentGenerationWorkspaceDarkV2.tsx +++ b/components/agents/AgentGenerationWorkspaceDarkV2.tsx @@ -322,6 +322,28 @@ function getCandidatePreviewUrl( ); } +function getCandidatePreviewUrls( + candidate: AgentModeReferenceCandidate, + target: AgentTaskDetailReferenceSource, + maxCount = 4 +) { + const rawTargetUrls = + target === "main" + ? candidate.mainImageUrls || [] + : target === "detail" + ? candidate.detailImageUrls || [] + : candidate.skuImageUrls || []; + const targetUrls = + target === "detail" && rawTargetUrls.length > 1 ? rawTargetUrls.slice(1) : rawTargetUrls; + const fallbackUrls = [ + ...targetUrls, + ...(candidate.mainImageUrls || []), + ...(candidate.allImageUrls || []), + ]; + + return Array.from(new Set(fallbackUrls.filter(Boolean))).slice(0, maxCount); +} + function getCandidateTargetCount( candidate: AgentModeReferenceCandidate, target: AgentTaskDetailReferenceSource @@ -2458,30 +2480,48 @@ export function AgentGenerationWorkspaceDarkV2({ 默认载入最新一套,可随时切换 -
+
{detailReplacementCandidates.map((candidate) => { const isSelected = detailReplacementSelectedCandidateId === candidate.id; - const previewUrl = getCandidatePreviewUrl(candidate, detailReferenceTarget); + const previewUrls = getCandidatePreviewUrls( + candidate, + detailReferenceTarget, + 4 + ); return (