fix: refine jump hop draft detail flow

This commit is contained in:
2026-06-06 21:02:11 +08:00
parent cd8088d1fd
commit 683a9115b3
11 changed files with 194 additions and 9 deletions

View File

@@ -185,9 +185,16 @@ export function executeJumpHopCreationAction(
.then(normalizeJumpHopActionResponse);
}
export async function getJumpHopWorkDetail(profileId: string) {
export async function getJumpHopWorkDetail(
profileId: string,
options: { audience?: 'creation' | 'runtime' } = {},
) {
const base =
options.audience === 'creation'
? JUMP_HOP_WORKS_API_BASE
: `${JUMP_HOP_RUNTIME_API_BASE}/works`;
const response = await requestJson<JumpHopWorkDetailResponse>(
`${JUMP_HOP_RUNTIME_API_BASE}/works/${encodeURIComponent(profileId)}`,
`${base}/${encodeURIComponent(profileId)}`,
{ method: 'GET' },
'读取跳一跳作品详情失败',
);

View File

@@ -529,6 +529,44 @@ describe('miniGameDraftGenerationProgress', () => {
]);
});
test('jump hop generation anchors hide unused style preset fallback', () => {
const entries = buildJumpHopGenerationAnchorEntries({
sessionId: 'jump-hop-session-style-hidden',
ownerUserId: 'user-1',
status: 'generating',
draft: {
templateId: 'jump-hop',
templateName: '跳一跳',
profileId: 'jump-hop-profile-style-hidden',
themeText: '水果',
workTitle: '水果跳一跳',
workDescription: '水果主题跳一跳。',
themeTags: ['水果'],
difficulty: 'standard',
stylePreset: 'minimal-blocks',
characterPrompt: '内置默认 3D 角色',
tilePrompt: '',
endMoodPrompt: null,
characterAsset: null,
tileAtlasAsset: null,
tileAssets: [],
path: null,
coverComposite: null,
generationStatus: 'generating',
},
createdAt: '2026-06-06T10:00:00.000Z',
updatedAt: '2026-06-06T10:00:00.000Z',
});
expect(entries).toEqual([
{
id: 'jump-hop-theme',
label: '主题',
value: '水果',
},
]);
});
test('wooden fish draft generation exposes hit object, background and back button pipeline', () => {
const state = createMiniGameDraftGenerationState('wooden-fish');

View File

@@ -1074,7 +1074,7 @@ export function buildJumpHopGenerationAnchorEntries(
workTitle?: string;
themeText?: string;
characterPrompt?: string;
stylePreset?: string;
tilePrompt?: string;
} | null;
}
| null
@@ -1098,7 +1098,7 @@ export function buildJumpHopGenerationAnchorEntries(
value:
formPayload?.tilePrompt?.trim() ||
config?.tilePrompt?.trim() ||
draft?.stylePreset?.trim() ||
draft?.tilePrompt?.trim() ||
'',
},
];