From 1b2daf47962b95d9269f1088aeb5d470c3dee6f3 Mon Sep 17 00:00:00 2001 From: kdletters Date: Sat, 25 Apr 2026 14:18:40 +0800 Subject: [PATCH] fix creation chat initial progress --- ...HAIN_REFACTOR_EXECUTION_PLAN_2026-04-21.md | 1 + .../CreationAgentWorkspace.test.tsx | 31 +++++++++++++++++++ .../creation-agent/CreationAgentWorkspace.tsx | 11 +++++-- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/docs/technical/CREATION_FLOW_CHAIN_REFACTOR_EXECUTION_PLAN_2026-04-21.md b/docs/technical/CREATION_FLOW_CHAIN_REFACTOR_EXECUTION_PLAN_2026-04-21.md index 698e5902..16bd8907 100644 --- a/docs/technical/CREATION_FLOW_CHAIN_REFACTOR_EXECUTION_PLAN_2026-04-21.md +++ b/docs/technical/CREATION_FLOW_CHAIN_REFACTOR_EXECUTION_PLAN_2026-04-21.md @@ -308,6 +308,7 @@ 2. 壳层文件内不再直接包含自动保存防抖实现。 3. 壳层文件内不再直接包含 session -> result profile 编译细节。 4. 壳层文件内不再直接处理 works/library/history/save 的多路请求编排。 +5. Agent 聊天工作区进入时必须如实展示后端 session 的 `progressPercent`。新会话后端初始值为 `0` 时,前端数字与进度条填充都必须保持 `0%`;只允许对大于 0 的值使用视觉最小宽度,避免用户误判聊天流程已经推进。 ## 5.2 custom world 专属 client 拆分方案 diff --git a/src/components/creation-agent/CreationAgentWorkspace.test.tsx b/src/components/creation-agent/CreationAgentWorkspace.test.tsx index 3d5d6192..66d5b7e4 100644 --- a/src/components/creation-agent/CreationAgentWorkspace.test.tsx +++ b/src/components/creation-agent/CreationAgentWorkspace.test.tsx @@ -32,6 +32,37 @@ function ensureScrollApis() { } } +test('creation agent workspace keeps initial chat progress at zero percent', () => { + ensureScrollApis(); + + render( + {}} + onSubmitText={() => {}} + onPrimaryAction={() => {}} + />, + ); + + const progressbar = screen.getByRole('progressbar'); + + expect(progressbar.getAttribute('aria-valuenow')).toBe('0'); + expect((progressbar.firstElementChild as HTMLElement | null)?.style.width).toBe( + '0%', + ); +}); + test('creation agent workspace filters duplicate recommended replies', () => { const consoleErrorSpy = vi .spyOn(console, 'error') diff --git a/src/components/creation-agent/CreationAgentWorkspace.tsx b/src/components/creation-agent/CreationAgentWorkspace.tsx index ccd54771..042a8441 100644 --- a/src/components/creation-agent/CreationAgentWorkspace.tsx +++ b/src/components/creation-agent/CreationAgentWorkspace.tsx @@ -311,6 +311,7 @@ export function CreationAgentWorkspace({ } const progress = normalizeCreationAgentProgress(session.progressPercent); + const progressFillWidth = progress <= 0 ? '0%' : `${Math.max(6, progress)}%`; const hasHeroCopy = Boolean(session.title || session.assistantSummary); const canShowPrimaryAction = progress >= 100; const visibleQuickActions = quickActions.filter((action) => @@ -414,10 +415,16 @@ export function CreationAgentWorkspace({ {progress}% -
+