fix: preserve ai detail placeholder cards
This commit is contained in:
parent
b62926cf6e
commit
de142d0be7
@ -1874,13 +1874,41 @@ export function AgentGenerationWorkspaceDarkV2({
|
||||
).length,
|
||||
[skuResultCards]
|
||||
);
|
||||
const detailGenerationExpectedCount = useMemo(() => {
|
||||
if (
|
||||
pendingGeneration?.modeType === "detail_generation" &&
|
||||
Number.isFinite(pendingGeneration.expectedCount) &&
|
||||
pendingGeneration.expectedCount > 0
|
||||
) {
|
||||
return pendingGeneration.expectedCount;
|
||||
}
|
||||
|
||||
const progressTotal = Number(detailGenerationProgress.total || 0);
|
||||
if (progressTotal > 1) {
|
||||
return Math.max(
|
||||
detailGenerationRunResults.length,
|
||||
Math.round((progressTotal - 1) / 2)
|
||||
);
|
||||
}
|
||||
|
||||
return detailGenerationRunResults.length;
|
||||
}, [
|
||||
detailGenerationProgress.total,
|
||||
detailGenerationRunResults.length,
|
||||
pendingGeneration?.expectedCount,
|
||||
pendingGeneration?.modeType,
|
||||
]);
|
||||
const hasDetailGenerationPlaceholderState =
|
||||
currentResultModeType === "detail_generation" &&
|
||||
detailGenerationExpectedCount > detailGenerationRunResults.length &&
|
||||
(pendingGeneration?.modeType === "detail_generation" ||
|
||||
detailGenerationProgress.status === "running" ||
|
||||
detailGenerationProgress.status === "error");
|
||||
const gridRequestedImageCount =
|
||||
activeResultModeType === "detail_generation"
|
||||
? Math.max(
|
||||
1,
|
||||
pendingGeneration?.modeType === "detail_generation"
|
||||
? pendingGeneration.expectedCount
|
||||
: activeResultModeUrls.length
|
||||
detailGenerationExpectedCount || activeResultModeUrls.length
|
||||
)
|
||||
: Math.max(1, imageParams.imageCount || 1);
|
||||
const gridPendingRemainingCount =
|
||||
@ -1888,9 +1916,9 @@ export function AgentGenerationWorkspaceDarkV2({
|
||||
pendingGeneration?.modeType === "scene_generation"
|
||||
? Math.max(pendingGeneration.expectedCount - currentSceneGeneratedUrls.length, 0)
|
||||
: activeResultModeType === "detail_generation" &&
|
||||
pendingGeneration?.modeType === "detail_generation"
|
||||
hasDetailGenerationPlaceholderState
|
||||
? Math.max(
|
||||
pendingGeneration.expectedCount - detailGenerationRunResults.length,
|
||||
detailGenerationExpectedCount - detailGenerationRunResults.length,
|
||||
0
|
||||
)
|
||||
: 0;
|
||||
@ -1922,7 +1950,11 @@ export function AgentGenerationWorkspaceDarkV2({
|
||||
url,
|
||||
status: url
|
||||
? ("completed" as const)
|
||||
: gridPendingRemainingCount > 0
|
||||
: activeResultModeType === "detail_generation" &&
|
||||
detailGenerationProgress.status === "error" &&
|
||||
gridPendingRemainingCount > 0
|
||||
? ("missing" as const)
|
||||
: gridPendingRemainingCount > 0
|
||||
? placeholderOffset === 0
|
||||
? ("generating" as const)
|
||||
: ("queued" as const)
|
||||
@ -1930,13 +1962,19 @@ export function AgentGenerationWorkspaceDarkV2({
|
||||
};
|
||||
});
|
||||
},
|
||||
[activeResultModeType, activeResultModeUrls, gridPendingRemainingCount, gridResultCardCount]
|
||||
[
|
||||
activeResultModeType,
|
||||
activeResultModeUrls,
|
||||
detailGenerationProgress.status,
|
||||
gridPendingRemainingCount,
|
||||
gridResultCardCount,
|
||||
]
|
||||
);
|
||||
const shouldShowGridResultSection =
|
||||
activeResultModeUrls.length > 0 ||
|
||||
((activeResultModeType === "scene_generation" && isSceneResultModeGenerating) ||
|
||||
(activeResultModeType === "detail_generation" &&
|
||||
isDetailGenerationResultModeGenerating));
|
||||
(isDetailGenerationResultModeGenerating || hasDetailGenerationPlaceholderState)));
|
||||
const attachmentCount = attachments.filter(Boolean).length;
|
||||
const hasBrandModelSelection = Boolean(
|
||||
selectedBrandModel?.imageUrl || referenceImages.some((image) => image.source === "brandModel")
|
||||
@ -4511,7 +4549,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
||||
isDetailAiGenerationMethod &&
|
||||
activeResultModeType === currentResultModeType ? (
|
||||
<div className="rounded-full bg-white/8 px-3 py-1 text-xs text-white/60">
|
||||
预估 {pendingGeneration?.expectedCount || detailGenerationRunResults.length || 0} 屏
|
||||
预估 {detailGenerationExpectedCount || 0} 屏
|
||||
</div>
|
||||
) : activeResultModeType === "sku_replacement" &&
|
||||
isSkuReplacementPreset &&
|
||||
@ -4529,6 +4567,13 @@ export function AgentGenerationWorkspaceDarkV2({
|
||||
处理中 {Math.min(pendingGenerationProgressCount, pendingGeneration.expectedCount)}/
|
||||
{pendingGeneration.expectedCount}
|
||||
</div>
|
||||
) : activeResultModeType === "detail_generation" &&
|
||||
detailGenerationProgress.status === "running" &&
|
||||
detailGenerationExpectedCount > 0 ? (
|
||||
<div className="rounded-full border border-sky-400/25 bg-sky-500/[0.10] px-3 py-1 text-xs text-sky-100">
|
||||
处理中 {Math.min(detailGenerationRunResults.length, detailGenerationExpectedCount)}/
|
||||
{detailGenerationExpectedCount}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user