From 65b3e2f1915e31845a29d9b4df61bdfec9abee72 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 May 2026 16:05:33 +0800 Subject: [PATCH] fix: optimize agent style workspace rendering --- .../agents/AgentGenerationWorkspaceDarkV2.tsx | 77 +++++++++++++++++-- .../agents/AgentWorkflowPanelDarkV2.tsx | 16 ++-- 2 files changed, 77 insertions(+), 16 deletions(-) diff --git a/components/agents/AgentGenerationWorkspaceDarkV2.tsx b/components/agents/AgentGenerationWorkspaceDarkV2.tsx index e2d915d4d..56b2fe83e 100644 --- a/components/agents/AgentGenerationWorkspaceDarkV2.tsx +++ b/components/agents/AgentGenerationWorkspaceDarkV2.tsx @@ -9,6 +9,7 @@ import { useMemo, useRef, useState, + type CSSProperties, type ReactNode, type SyntheticEvent, } from "react"; @@ -489,6 +490,16 @@ function buildPreviewImageUrl(url: string, width: number) { return buildImageProxyUrl(url, { width, quality: 86, format: "webp" }); } +const AGENT_DEFERRED_SECTION_STYLE = { + contentVisibility: "auto", + containIntrinsicSize: "1px 760px", +} as CSSProperties; + +const AGENT_DEFERRED_RESULTS_STYLE = { + contentVisibility: "auto", + containIntrinsicSize: "1px 900px", +} as CSSProperties; + function handlePreviewImageLoadError( event: SyntheticEvent, originalUrl: string @@ -5381,6 +5392,8 @@ export function AgentGenerationWorkspaceDarkV2({ {attachment.name handlePreviewImageLoadError(event, attachment.url)} /> @@ -5527,9 +5540,8 @@ export function AgentGenerationWorkspaceDarkV2({
{visibleAttachmentUploadSlots.map((slot, index) => { return ( - handlePreviewImageLoadError(event, attachments[index]!.url) @@ -5589,7 +5603,7 @@ export function AgentGenerationWorkspaceDarkV2({ {attachments[index] ? "更换" : "上传"}
- + ); })} @@ -5677,10 +5691,15 @@ export function AgentGenerationWorkspaceDarkV2({ animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.06 }} className="rounded-[28px] border border-white/12 bg-white/[0.04] p-5 shadow-[inset_0_1px_0_rgba(255,255,255,0.03)]" + style={AGENT_DEFERRED_SECTION_STYLE} >
{hasBrandStoreStep ? ( -
+
@@ -5699,7 +5718,11 @@ export function AgentGenerationWorkspaceDarkV2({ ) : null} {hasWorkflowStyleStep ? ( -
+
@@ -5721,7 +5744,11 @@ export function AgentGenerationWorkspaceDarkV2({ ) : null} {isBusinessModeStepEnabled ? ( -
+
@@ -5776,6 +5803,8 @@ export function AgentGenerationWorkspaceDarkV2({ {mode.title} ) : ( @@ -5819,7 +5848,11 @@ export function AgentGenerationWorkspaceDarkV2({ ) : null} {hasMaterialStep ? ( -
+
@@ -5835,7 +5868,11 @@ export function AgentGenerationWorkspaceDarkV2({
) : null} -
+
@@ -6162,6 +6199,7 @@ export function AgentGenerationWorkspaceDarkV2({ initial={{ opacity: 0, scale: 0.98 }} animate={{ opacity: 1, scale: 1 }} transition={{ delay: 0.08 }} + style={AGENT_DEFERRED_SECTION_STYLE} >
@@ -6388,6 +6426,8 @@ export function AgentGenerationWorkspaceDarkV2({ {candidate.sceneName handlePreviewImageLoadError(event, primaryPreviewUrl) @@ -6471,6 +6511,7 @@ export function AgentGenerationWorkspaceDarkV2({ initial={{ opacity: 0, scale: 0.98 }} animate={{ opacity: 1, scale: 1 }} transition={{ delay: 0.12 }} + style={AGENT_DEFERRED_RESULTS_STYLE} >
@@ -6657,6 +6698,8 @@ export function AgentGenerationWorkspaceDarkV2({ {attachment!.name handlePreviewImageLoadError(event, attachment!.url) @@ -6685,6 +6728,8 @@ export function AgentGenerationWorkspaceDarkV2({ {selectedModelAttachment.name handlePreviewImageLoadError(event, selectedModelAttachment.url) @@ -6777,6 +6822,8 @@ export function AgentGenerationWorkspaceDarkV2({ {card.label} handlePreviewImageLoadError(event, card.imageUrl || "") @@ -6866,6 +6913,8 @@ export function AgentGenerationWorkspaceDarkV2({ {`结果图 handlePreviewImageLoadError(event, card.resultUrl!) @@ -7020,6 +7069,8 @@ export function AgentGenerationWorkspaceDarkV2({ {attachment!.name handlePreviewImageLoadError(event, attachment!.url) @@ -7048,6 +7099,8 @@ export function AgentGenerationWorkspaceDarkV2({ {selectedModelAttachment.name handlePreviewImageLoadError(event, selectedModelAttachment.url) @@ -7193,6 +7246,8 @@ export function AgentGenerationWorkspaceDarkV2({ {candidate.sceneName handlePreviewImageLoadError(event, previewUrl) @@ -7277,6 +7332,8 @@ export function AgentGenerationWorkspaceDarkV2({ {card.label} handlePreviewImageLoadError(event, card.imageUrl || "") @@ -7384,6 +7441,8 @@ export function AgentGenerationWorkspaceDarkV2({ {`结果图 handlePreviewImageLoadError(event, card.resultUrl!) @@ -7551,6 +7610,7 @@ export function AgentGenerationWorkspaceDarkV2({ alt={`${getResultModeLabel(activeResultModeType)} 结果图 ${card.index + 1}`} className="h-full w-full object-contain p-2" loading="lazy" + decoding="async" /> {isSceneResultCard ? ( <> @@ -7873,6 +7933,7 @@ export function AgentGenerationWorkspaceDarkV2({ 预览 e.stopPropagation()} /> diff --git a/components/agents/AgentWorkflowPanelDarkV2.tsx b/components/agents/AgentWorkflowPanelDarkV2.tsx index 469c313b8..5879dbd3a 100644 --- a/components/agents/AgentWorkflowPanelDarkV2.tsx +++ b/components/agents/AgentWorkflowPanelDarkV2.tsx @@ -111,12 +111,12 @@ const VIRTUAL_OPTION_GRID_GAP = 16; const VIRTUAL_OPTION_GRID_MAX_HEIGHT = 640; const VIRTUAL_OPTION_GRID_MIN_CARD_HEIGHT = 122; const VIRTUAL_OPTION_GRID_THRESHOLD = 12; -const WORKFLOW_OPTION_PREVIEW_WIDTH = 360; -const WORKFLOW_OPTION_PREVIEW_QUALITY = 58; -const WORKFLOW_OPTION_PREVIEW_EAGER_COUNT = 4; -const WORKFLOW_OPTION_NEXT_PREVIEW_PREFETCH_COUNT = 6; -const WORKFLOW_OPTION_PREFETCH_CACHE_LIMIT = 48; -const WORKFLOW_OPTION_PREFETCH_BATCH_SIZE = 2; +const WORKFLOW_OPTION_PREVIEW_WIDTH = 320; +const WORKFLOW_OPTION_PREVIEW_QUALITY = 56; +const WORKFLOW_OPTION_PREVIEW_EAGER_COUNT = 2; +const WORKFLOW_OPTION_NEXT_PREVIEW_PREFETCH_COUNT = 3; +const WORKFLOW_OPTION_PREFETCH_CACHE_LIMIT = 30; +const WORKFLOW_OPTION_PREFETCH_BATCH_SIZE = 1; function isLikelyStoredWorkflowPreview(url: string, sourceUrl?: string | null) { const source = String(sourceUrl || "").trim(); @@ -472,8 +472,8 @@ const StepOptionCard = memo(function StepOptionCard({ handleWorkflowOptionPreviewError(event, option.previewImageUrl) } className={cn( - "h-full w-full object-cover transition-transform duration-700", - !disabled && "group-hover:scale-110" + "h-full w-full object-cover transition-transform duration-500", + !disabled && "group-hover:scale-[1.04]" )} />