From b088d65a66b3221aed9ef03f9d546c302d17e4ab Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 26 Mar 2026 21:01:10 +0800 Subject: [PATCH] improve workflow timeline and resize controls --- .../agents/AgentWorkflowPanelDarkV2.tsx | 173 +++++++++++------- components/image-annotator.tsx | 58 ++++++ 2 files changed, 167 insertions(+), 64 deletions(-) diff --git a/components/agents/AgentWorkflowPanelDarkV2.tsx b/components/agents/AgentWorkflowPanelDarkV2.tsx index 99fc21a06..fdf9992fc 100644 --- a/components/agents/AgentWorkflowPanelDarkV2.tsx +++ b/components/agents/AgentWorkflowPanelDarkV2.tsx @@ -156,6 +156,14 @@ function getWorkflowStepOptionLevels(params: { return levels; } +function getWorkflowOptionDepthLabel(depth: number) { + return depth === 1 ? "主卡片" : `${depth}级子卡片`; +} + +function getWorkflowOptionDepthShortLabel(depth: number) { + return depth === 1 ? "主" : `${depth}级`; +} + function StepOptionCard({ option, step, @@ -695,7 +703,10 @@ export function AgentWorkflowPanelDarkV2({ selectionValue: selections[step.key], }); const active = step.key === activeEmbeddedStepEntry.step.key; - const stepSummary = stepSelectionSummaryMap[step.key] || ""; + const stepSelectedPath = getAgentWorkflowSelectedOptionPath({ + step, + selectionValue: selections[step.key], + }); const stepOptionLevels = getWorkflowStepOptionLevels({ step, selectionValue: selections[step.key], @@ -707,9 +718,9 @@ export function AgentWorkflowPanelDarkV2({ const activeStepChildLabel = active && stepOptionLevels.length > 1 ? `${ - activeEmbeddedOptionLevel?.depth === 1 - ? "主卡片" - : `${activeEmbeddedOptionLevel?.depth || 1}级子卡片` + getWorkflowOptionDepthLabel( + activeEmbeddedOptionLevel?.depth || 1 + ) }` : deepestSelectedLevel > 1 ? `已到 ${deepestSelectedLevel} 级` @@ -717,68 +728,102 @@ export function AgentWorkflowPanelDarkV2({ return ( - + {stepSelectedPath.length > 0 ? ( +
+ {stepSelectedPath.map((option, optionIndex) => { + const optionDepth = optionIndex + 1; + const optionLevelActive = + active && + (activeEmbeddedOptionLevel?.depth || 1) === optionDepth; + + return ( + + ); + })} +
+ ) : ( + + 待选择 - ) : null} + )} {stepIndex < flattenedResolvedSteps.length - 1 ? (
) : null} - +
); })} diff --git a/components/image-annotator.tsx b/components/image-annotator.tsx index b59559fcd..b2430c2af 100644 --- a/components/image-annotator.tsx +++ b/components/image-annotator.tsx @@ -350,6 +350,10 @@ export function ImageAnnotator({ { label: "4:5", value: "4:5", ratio: 4 / 5 }, { label: "21:9", value: "21:9", ratio: 21 / 9 }, ]; + const resizeQuickPresets = [ + { label: "主图 1440×1440", width: 1440, height: 1440, aspectRatioValue: "1:1" }, + { label: "主图 1440×1920", width: 1440, height: 1920, aspectRatioValue: "3:4" }, + ] as const; // 根据比例和宽度计算高度 const calculateHeightFromWidth = (width: number, ratio: number | null) => { @@ -396,6 +400,14 @@ export function ImageAnnotator({ } }; + const handleResizeQuickPresetSelect = ( + preset: (typeof resizeQuickPresets)[number] + ) => { + setResizeCanvasWidth(preset.width); + setResizeCanvasHeight(preset.height); + setSelectedAspectRatio(preset.aspectRatioValue); + }; + // 确保在客户端渲染 useEffect(() => { setMounted(true); @@ -1019,6 +1031,14 @@ export function ImageAnnotator({ setResizeImageScale(newScale); }; + const handleResizeScaleSliderChange = (value: number[]) => { + const nextScale = value[0]; + if (!isResizeMode || typeof nextScale !== "number" || Number.isNaN(nextScale)) { + return; + } + setResizeImageScale(Math.max(0.1, Math.min(5, nextScale))); + }; + // 尺寸调整:渲染预览 useEffect(() => { if (!isResizeMode || !resizeCanvasRef.current || !image || !resizeContainerRef.current) return; @@ -1754,6 +1774,44 @@ export function ImageAnnotator({ />
+
+ {resizeQuickPresets.map((preset) => { + const isActive = + resizeCanvasWidth === preset.width && resizeCanvasHeight === preset.height; + return ( + + ); + })} +
+
+
+ + 缩放 + + + + {(resizeImageScale * 100).toFixed(0)}% + +
+