This commit is contained in:
2026-04-23 03:51:14 +08:00
parent 1223f597d2
commit 8530cd0d8e
11 changed files with 241 additions and 54 deletions

View File

@@ -205,3 +205,40 @@ test('creation agent workspace shows primary and progress actions at completed p
expect(screen.getByRole('button', { name: '总结当前设定' })).toBeTruthy();
expect(screen.getByRole('button', { name: '补全剩余设定' })).toBeTruthy();
});
test('creation agent workspace hides hero copy area when title and summary are absent', () => {
if (!Element.prototype.scrollIntoView) {
Element.prototype.scrollIntoView = () => {};
}
render(
<CreationAgentWorkspace
session={{
sessionId: 'creation-agent-session-1',
title: null,
assistantSummary: null,
currentTurn: 2,
progressPercent: 60,
anchors: [],
messages: [
{
id: 'message-1',
role: 'assistant',
kind: 'chat',
text: '继续把设定收束到可生成状态。',
},
],
}}
theme={testTheme}
loadingText="正在准备"
composerPlaceholder="输入消息"
primaryActionLabel="生成结果页"
onBack={() => {}}
onSubmitText={() => {}}
onPrimaryAction={() => {}}
/>,
);
expect(screen.queryByText('统一共创')).toBeNull();
expect(screen.getByText('创作进度')).toBeTruthy();
});

View File

@@ -34,7 +34,7 @@ export type CreationAgentOperationView = {
export type CreationAgentSessionView = {
sessionId: string;
title: string;
title?: string | null;
assistantSummary?: string | null;
currentTurn: number;
progressPercent: number;
@@ -267,6 +267,7 @@ export function CreationAgentWorkspace({
}
const progress = normalizeCreationAgentProgress(session.progressPercent);
const hasHeroCopy = Boolean(session.title || session.assistantSummary);
const canShowPrimaryAction = progress >= 100;
const visibleQuickActions = quickActions.filter((action) =>
shouldShowQuickAction(action, session, progress),
@@ -313,18 +314,22 @@ export function CreationAgentWorkspace({
) : null}
</div>
<div className="mt-6">
<div className="text-2xl font-black leading-tight sm:text-3xl">
{session.title}
{hasHeroCopy ? (
<div className="mt-6">
{session.title ? (
<div className="text-2xl font-black leading-tight sm:text-3xl">
{session.title}
</div>
) : null}
{session.assistantSummary ? (
<div className="mt-2 max-w-2xl text-sm leading-6 text-white/76">
{session.assistantSummary}
</div>
) : null}
</div>
{session.assistantSummary ? (
<div className="mt-2 max-w-2xl text-sm leading-6 text-white/76">
{session.assistantSummary}
</div>
) : null}
</div>
) : null}
<div className="mt-4">
<div className={hasHeroCopy ? 'mt-4' : 'mt-6'}>
<div className="mb-2 flex items-center justify-between gap-3">
<span className="text-xs font-semibold tracking-[0.14em] text-white/72">