feat: simplify AI design for young creators

This commit is contained in:
2026-09-02 17:48:03 +08:00
parent 7552cf5952
commit 756638a28a
17 changed files with 3595 additions and 297 deletions

View File

@@ -96,7 +96,7 @@ test.describe('AI Design V2 workspace', () => {
}
});
test('keeps conversation and direct edits on one Living Form through immutable confirmation', async ({ launchElectronApp }) => {
test('keeps conversation and youth-friendly direct edits on one canonical design through production confirmation', async ({ launchElectronApp }) => {
test.setTimeout(120_000);
const app = await launchElectronApp({ skipSetup: true });
@@ -193,7 +193,7 @@ test.describe('AI Design V2 workspace', () => {
turnId: 'turn-1',
rawTurnSequence: 1,
userMessage: '做一张便携咖啡机的小红书主视觉',
assistantMessage: '我已经把用途和初步构想写入设计表单。',
assistantMessage: '明白了:你想做一张适合小红书的便携咖啡机图片。',
}],
tasks: [] as Array<Record<string, unknown>>,
assets: [],
@@ -278,6 +278,9 @@ test.describe('AI Design V2 workspace', () => {
if (operation.kind === 'set' && operation.path === 'output.aspect_ratio') {
workspace.form.specification.values.output.aspect_ratio = String(operation.value ?? '');
}
if (operation.kind === 'set' && operation.path === 'output.orientation') {
workspace.form.specification.values.output.orientation = String(operation.value ?? '');
}
}
}
if (command.input?.kind === 'chat' && command.input.message) {
@@ -286,7 +289,7 @@ test.describe('AI Design V2 workspace', () => {
turnId: `turn-${workspace.form.rawTurnSequence}`,
rawTurnSequence: workspace.form.rawTurnSequence,
userMessage: command.input.message,
assistantMessage: '已把这条补充写入同一份设计规格。',
assistantMessage: '记住了:主体更简洁,也会为标题留出空间。',
});
}
workspace.form.directionRevision += 1;
@@ -403,50 +406,72 @@ test.describe('AI Design V2 workspace', () => {
(globalThis as typeof globalThis & { __designE2eProfileReady?: boolean }).__designE2eProfileReady,
))).toBe(true);
await expect(page.getByTestId('image-workspace-conversation')).toBeVisible();
await expect(page.getByTestId('image-workspace-living-form')).toBeVisible();
await expect(page.getByText('Living Form')).toBeVisible();
await expect(page.getByText('目标与用途')).toBeVisible();
await expect(page.getByText('内容与叙事')).toBeVisible();
await expect(page.getByTestId('image-workspace-creation-pane')).toBeVisible();
await expect(page.getByRole('heading', { name: '我的创作' })).toBeVisible();
await expect(page.getByText('把便携咖啡机呈现为城市通勤中的精密工具')).toBeVisible();
await expect(page.getByText('Living Form')).toHaveCount(0);
await expect(page.getByText('目标与用途')).toHaveCount(0);
await expect(page.locator('[data-testid^="sidebar-image-conversation-"]')).toHaveCount(0);
const layout = await page.evaluate(() => {
const conversation = document.querySelector('[data-testid="image-workspace-conversation"]')
?.getBoundingClientRect();
const form = document.querySelector('[data-testid="image-workspace-living-form"]')
const cardPane = document.querySelector('[data-testid="image-workspace-creation-pane"]')
?.getBoundingClientRect();
return conversation && form
? { conversationHeight: conversation.height, formHeight: form.height, topGap: Math.abs(conversation.top - form.top) }
return conversation && cardPane
? {
conversationHeight: conversation.height,
cardHeight: cardPane.height,
topGap: Math.abs(conversation.top - cardPane.top),
conversationWidth: conversation.width,
cardWidth: cardPane.width,
}
: null;
});
expect(layout).not.toBeNull();
expect(layout!.conversationHeight).toBeGreaterThan(300);
expect(Math.abs(layout!.conversationHeight - layout!.formHeight)).toBeLessThanOrEqual(1);
expect(Math.abs(layout!.conversationHeight - layout!.cardHeight)).toBeLessThanOrEqual(1);
expect(layout!.topGap).toBeLessThanOrEqual(1);
expect(layout!.conversationWidth).toBeGreaterThan(layout!.cardWidth);
const ratioInput = page.getByLabel('画幅比例');
await ratioInput.fill('16:9');
await expect(ratioInput).toHaveValue('16:9');
await page.getByRole('button', { name: '保存', exact: true }).click();
await expect(page.getByText('方向 5')).toBeVisible();
const desktopViewport = page.viewportSize();
await page.setViewportSize({ width: 375, height: 800 });
await expect(page.getByTestId('image-workspace-conversation')).toBeVisible();
await expect(page.getByTestId('image-workspace-creation-pane')).toBeHidden();
await page.getByRole('button', { name: /^我的创作/ }).click();
await expect(page.getByTestId('youth-creation-card')).toBeVisible();
await page.keyboard.press('Escape');
await page.setViewportSize({ width: 768, height: 800 });
await expect(page.getByTestId('image-workspace-conversation')).toBeVisible();
await expect(page.getByTestId('image-workspace-creation-pane')).toBeHidden();
await page.setViewportSize(desktopViewport ?? { width: 1280, height: 800 });
await expect(page.getByTestId('image-workspace-creation-pane')).toBeVisible();
await page.getByRole('button', { name: '精细调整' }).click();
await page.getByRole('button', { name: '电脑横屏' }).click();
await page.getByRole('button', { name: '完成调整' }).click();
await expect(page.getByTestId('youth-creation-card').getByText('电脑横屏')).toBeVisible();
const followUp = '主体更克制,留出品牌标题空间';
await page.getByLabel('给设计 Agent 留言').fill(followUp);
await page.getByLabel('给设计 Agent 留言').press('Enter');
await page.getByLabel('告诉 AI 你想创作什么').fill(followUp);
await page.getByLabel('告诉 AI 你想创作什么').press('Enter');
await expect(page.getByTestId('image-workspace-conversation')).toContainText(followUp);
await expect(page.getByTestId('image-workspace-conversation'))
.toContainText('已把这条补充写入同一份设计规格。');
.toContainText('记住了:主体更简洁,也会为标题留出空间。');
await page.getByRole('button', { name: '编译生成方案' }).click();
await expect(page.getByText('报价已冻结')).toBeVisible();
await expect(page.getByText('对应规格版本 5,确认后不会再读取当前表单的新修改。')).toBeVisible();
await expect(page.getByText('确认即按此不可变报价创建任务,不会在客户端拼接或改写提示词。')).toBeVisible();
await page.getByRole('button', { name: '看看制作方案' }).click();
await expect(page.getByRole('heading', { name: '制作方案准备好了' })).toBeVisible();
await expect(page.getByText('开始后会按现在的想法制作;如果再改想法,需要重新准备方案。')).toBeVisible();
await expect(page.getByLabel(/Prompt|提示词/i)).toHaveCount(0);
await expect(page.getByText(/规格版本|编译器|生成方式|不可变/)).toHaveCount(0);
await page.getByRole('button', { name: '确认生成' }).click();
await expect(page.getByText('生成任务')).toBeVisible();
await expect(page.getByText('图片任务')).toBeVisible();
await expect(page.getByText('排队中')).toBeVisible();
await expect(page.getByText('正常')).toBeVisible();
await page.getByRole('button', { name: '花 12 设计点开始制作' }).click();
await expect(page.getByText('作品进度')).toBeVisible();
await expect(page.getByRole('heading', { name: '我的图片', exact: true })).toBeVisible();
await expect(page.getByText('正在准备', { exact: true })).toBeVisible();
await expect(page.getByText('正在准备画面').first()).toBeVisible();
await expect(page.getByText('1200', { exact: true })).toHaveCount(0);
} finally {
await closeElectronApp(app);