fix creation chat initial progress
This commit is contained in:
@@ -308,6 +308,7 @@
|
|||||||
2. 壳层文件内不再直接包含自动保存防抖实现。
|
2. 壳层文件内不再直接包含自动保存防抖实现。
|
||||||
3. 壳层文件内不再直接包含 session -> result profile 编译细节。
|
3. 壳层文件内不再直接包含 session -> result profile 编译细节。
|
||||||
4. 壳层文件内不再直接处理 works/library/history/save 的多路请求编排。
|
4. 壳层文件内不再直接处理 works/library/history/save 的多路请求编排。
|
||||||
|
5. Agent 聊天工作区进入时必须如实展示后端 session 的 `progressPercent`。新会话后端初始值为 `0` 时,前端数字与进度条填充都必须保持 `0%`;只允许对大于 0 的值使用视觉最小宽度,避免用户误判聊天流程已经推进。
|
||||||
|
|
||||||
## 5.2 custom world 专属 client 拆分方案
|
## 5.2 custom world 专属 client 拆分方案
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,37 @@ function ensureScrollApis() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test('creation agent workspace keeps initial chat progress at zero percent', () => {
|
||||||
|
ensureScrollApis();
|
||||||
|
|
||||||
|
render(
|
||||||
|
<CreationAgentWorkspace
|
||||||
|
session={{
|
||||||
|
sessionId: 'creation-agent-session-1',
|
||||||
|
title: null,
|
||||||
|
currentTurn: 0,
|
||||||
|
progressPercent: 0,
|
||||||
|
anchors: [],
|
||||||
|
messages: [],
|
||||||
|
}}
|
||||||
|
theme={testTheme}
|
||||||
|
loadingText="正在准备"
|
||||||
|
composerPlaceholder="输入消息"
|
||||||
|
primaryActionLabel="生成结果页"
|
||||||
|
onBack={() => {}}
|
||||||
|
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', () => {
|
test('creation agent workspace filters duplicate recommended replies', () => {
|
||||||
const consoleErrorSpy = vi
|
const consoleErrorSpy = vi
|
||||||
.spyOn(console, 'error')
|
.spyOn(console, 'error')
|
||||||
|
|||||||
@@ -311,6 +311,7 @@ export function CreationAgentWorkspace({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const progress = normalizeCreationAgentProgress(session.progressPercent);
|
const progress = normalizeCreationAgentProgress(session.progressPercent);
|
||||||
|
const progressFillWidth = progress <= 0 ? '0%' : `${Math.max(6, progress)}%`;
|
||||||
const hasHeroCopy = Boolean(session.title || session.assistantSummary);
|
const hasHeroCopy = Boolean(session.title || session.assistantSummary);
|
||||||
const canShowPrimaryAction = progress >= 100;
|
const canShowPrimaryAction = progress >= 100;
|
||||||
const visibleQuickActions = quickActions.filter((action) =>
|
const visibleQuickActions = quickActions.filter((action) =>
|
||||||
@@ -414,10 +415,16 @@ export function CreationAgentWorkspace({
|
|||||||
{progress}%
|
{progress}%
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="h-2 overflow-hidden rounded-full bg-white/12">
|
<div
|
||||||
|
className="h-2 overflow-hidden rounded-full bg-white/12"
|
||||||
|
role="progressbar"
|
||||||
|
aria-valuemin={0}
|
||||||
|
aria-valuemax={100}
|
||||||
|
aria-valuenow={progress}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
className={`h-full rounded-full transition-all ${theme.accentBgClass}`}
|
className={`h-full rounded-full transition-all ${theme.accentBgClass}`}
|
||||||
style={{ width: `${Math.max(6, progress)}%` }}
|
style={{ width: progressFillWidth }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-2 text-xs leading-5 text-white/64">
|
<div className="mt-2 text-xs leading-5 text-white/64">
|
||||||
|
|||||||
Reference in New Issue
Block a user