@@ -14,8 +14,8 @@ const baseOperation: CustomWorldAgentOperationRecord = {
|
||||
operationId: 'operation-1',
|
||||
type: 'draft_foundation',
|
||||
status: 'running',
|
||||
phaseLabel: '生成世界底稿',
|
||||
phaseDetail: '正在根据已确认锚点编译第一版世界结构。',
|
||||
phaseLabel: '生成场景角色',
|
||||
phaseDetail: '正在生成场景角色第 1 / 1 批,当前已完成 0/4。',
|
||||
progress: 38,
|
||||
error: null,
|
||||
};
|
||||
@@ -96,7 +96,7 @@ const baseSession: CustomWorldAgentSessionSnapshot = {
|
||||
updatedAt: '2026-04-14T10:00:00.000Z',
|
||||
};
|
||||
|
||||
test('maps running draft_foundation operation to legacy generation progress', () => {
|
||||
test('maps running draft_foundation operation to refined generation progress steps', () => {
|
||||
const progress = buildAgentDraftFoundationGenerationProgress(
|
||||
baseOperation,
|
||||
1_000,
|
||||
@@ -104,21 +104,51 @@ test('maps running draft_foundation operation to legacy generation progress', ()
|
||||
);
|
||||
|
||||
expect(progress).not.toBeNull();
|
||||
expect(progress?.phaseId).toBe('foundation');
|
||||
expect(progress?.batchLabel).toBe('生成世界底稿');
|
||||
expect(progress?.phaseId).toBe('story-outline');
|
||||
expect(progress?.batchLabel).toBe('生成场景角色');
|
||||
expect(progress?.overallProgress).toBe(38);
|
||||
expect(progress?.elapsedMs).toBe(4_000);
|
||||
expect(progress?.estimatedRemainingMs).toBeGreaterThan(0);
|
||||
expect(progress?.steps).toHaveLength(13);
|
||||
expect(progress?.steps.map((step) => step.status)).toEqual([
|
||||
'completed',
|
||||
'completed',
|
||||
'completed',
|
||||
'active',
|
||||
'pending',
|
||||
'pending',
|
||||
'pending',
|
||||
'pending',
|
||||
'pending',
|
||||
'pending',
|
||||
'pending',
|
||||
'pending',
|
||||
'pending',
|
||||
]);
|
||||
expect(isDraftFoundationOperationRunning(baseOperation)).toBe(true);
|
||||
});
|
||||
|
||||
test('marks all legacy progress steps complete when draft foundation finishes', () => {
|
||||
test('maps auto asset phases to refined generation progress steps', () => {
|
||||
const progress = buildAgentDraftFoundationGenerationProgress(
|
||||
{
|
||||
...baseOperation,
|
||||
phaseLabel: '生成幕背景图',
|
||||
phaseDetail: '正在生成幕背景图 3/6:潮汐码头 · 封锁加压。',
|
||||
progress: 99,
|
||||
},
|
||||
1_000,
|
||||
5_000,
|
||||
);
|
||||
|
||||
expect(progress?.phaseId).toBe('act-backgrounds');
|
||||
expect(progress?.batchLabel).toBe('生成幕背景图');
|
||||
expect(progress?.steps.filter((step) => step.status === 'completed')).toHaveLength(
|
||||
10,
|
||||
);
|
||||
expect(progress?.steps[10]?.status).toBe('active');
|
||||
});
|
||||
|
||||
test('marks all refined progress steps complete when draft foundation finishes', () => {
|
||||
const progress = buildAgentDraftFoundationGenerationProgress(
|
||||
{
|
||||
...baseOperation,
|
||||
@@ -138,6 +168,28 @@ test('marks all legacy progress steps complete when draft foundation finishes',
|
||||
);
|
||||
});
|
||||
|
||||
test('keeps failed draft foundation progress on explicit failure state instead of pretending it is still compiling cards', () => {
|
||||
const progress = buildAgentDraftFoundationGenerationProgress(
|
||||
{
|
||||
...baseOperation,
|
||||
status: 'failed',
|
||||
phaseLabel: '底稿生成失败',
|
||||
phaseDetail: '角色主形象补齐失败,但世界底稿尚未完成写回。',
|
||||
progress: 100,
|
||||
error: 'dashscope timeout',
|
||||
},
|
||||
1_000,
|
||||
5_000,
|
||||
);
|
||||
|
||||
expect(progress?.phaseId).toBe('failed');
|
||||
expect(progress?.phaseLabel).toBe('底稿生成失败');
|
||||
expect(progress?.phaseDetail).toContain('角色主形象补齐失败');
|
||||
expect(progress?.steps.some((step) => step.label === '编译草稿卡')).toBe(true);
|
||||
expect(progress?.steps.some((step) => step.status === 'active')).toBe(false);
|
||||
expect(progress?.steps.filter((step) => step.status === 'completed').length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('builds readable draft setting text from creator intent first', () => {
|
||||
const settingText = buildAgentDraftFoundationSettingText(baseSession);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user