fix: keep first detail reference image
This commit is contained in:
parent
583145c97c
commit
1c1f7026d5
@ -134,11 +134,7 @@ function getRenderableCandidateTargetUrls(
|
||||
candidate: AgentModeReferenceCandidate,
|
||||
target: "main" | "detail" | "sku"
|
||||
) {
|
||||
const urls = getCandidateTargetUrls(candidate, target);
|
||||
if (target === "detail" && urls.length > 1) {
|
||||
return urls.slice(1);
|
||||
}
|
||||
return urls;
|
||||
return getCandidateTargetUrls(candidate, target);
|
||||
}
|
||||
|
||||
function buildReferenceItems(params: {
|
||||
|
||||
@ -304,8 +304,7 @@ function buildReferenceCardsFromCandidate(params: {
|
||||
: params.target === "detail"
|
||||
? candidate.detailImageUrls || []
|
||||
: candidate.skuImageUrls || [];
|
||||
const urls =
|
||||
params.target === "detail" && rawUrls.length > 1 ? rawUrls.slice(1) : rawUrls;
|
||||
const urls = rawUrls;
|
||||
const targetLabel = `${getTaskDetailReferenceSourceLabel(params.target)}参考图`;
|
||||
const prefix =
|
||||
candidate.sceneName || candidate.taskNo || candidate.productModel || "候选整套";
|
||||
@ -330,7 +329,7 @@ function formatCandidateMeta(candidate: AgentModeReferenceCandidate, target: Age
|
||||
: target === "detail"
|
||||
? candidate.detailImageUrls.length
|
||||
: candidate.skuImageUrls.length;
|
||||
const imageCount = target === "detail" && rawImageCount > 1 ? rawImageCount - 1 : rawImageCount;
|
||||
const imageCount = rawImageCount;
|
||||
const uploadedAt = candidate.uploadedAt ? new Date(candidate.uploadedAt) : null;
|
||||
const timeText =
|
||||
uploadedAt && !Number.isNaN(uploadedAt.getTime())
|
||||
@ -361,8 +360,7 @@ function getCandidatePreviewUrl(
|
||||
: target === "detail"
|
||||
? candidate.detailImageUrls || []
|
||||
: candidate.skuImageUrls || [];
|
||||
const targetUrls =
|
||||
target === "detail" && rawTargetUrls.length > 1 ? rawTargetUrls.slice(1) : rawTargetUrls;
|
||||
const targetUrls = rawTargetUrls;
|
||||
return (
|
||||
targetUrls[0] ||
|
||||
candidate.mainImageUrls[0] ||
|
||||
@ -382,8 +380,7 @@ function getCandidatePreviewUrls(
|
||||
: target === "detail"
|
||||
? candidate.detailImageUrls || []
|
||||
: candidate.skuImageUrls || [];
|
||||
const targetUrls =
|
||||
target === "detail" && rawTargetUrls.length > 1 ? rawTargetUrls.slice(1) : rawTargetUrls;
|
||||
const targetUrls = rawTargetUrls;
|
||||
const fallbackUrls = [
|
||||
...targetUrls,
|
||||
...(candidate.mainImageUrls || []),
|
||||
@ -403,7 +400,7 @@ function getCandidateTargetCount(
|
||||
: target === "detail"
|
||||
? candidate.detailImageUrls.length
|
||||
: candidate.skuImageUrls.length;
|
||||
return target === "detail" && rawCount > 1 ? rawCount - 1 : rawCount;
|
||||
return rawCount;
|
||||
}
|
||||
|
||||
type ReplacementCardStatus =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user