diff --git a/src/components/image-editor/ImageCanvasGenerationDialogModel.test.ts b/src/components/image-editor/ImageCanvasGenerationDialogModel.test.ts index 7cd0757be..235b3f282 100644 --- a/src/components/image-editor/ImageCanvasGenerationDialogModel.test.ts +++ b/src/components/image-editor/ImageCanvasGenerationDialogModel.test.ts @@ -1206,6 +1206,38 @@ describe('ImageCanvasGenerationDialogModel', () => { }); }); + it('maps legacy ui spec.generate inputs to the unified icon spec composer', () => { + expect( + createSameSourceGenerationDialogDraft({ + sourceLayer: createLayer({ + sourceType: 'generated', + assetKind: 'icon-spec', + generationInputs: { + version: 2, + action: 'spec.generate', + fields: [ + { id: 'specType', title: '规范类型', value: 'ui' }, + { id: 'playSetting', title: '玩法设定', value: '消除玩法' }, + { id: 'artStyle', title: '美术风格', value: '糖果玻璃' }, + ], + references: [], + }, + }), + availableLayers: [], + canvasSize: { width: 960, height: 720 }, + viewport: { x: 0, y: 0, scale: 1 }, + mode: 'redraw', + }), + ).toMatchObject({ + mode: 'spec', + specType: 'icon', + specValues: { + playSetting: '消除玩法', + artStyle: '糖果玻璃', + }, + }); + }); + it('restores the narrowly scoped legacy scene recipe into the scene composer', () => { expect( createSameSourceGenerationDialogDraft({ diff --git a/src/components/image-editor/ImageCanvasGenerationDialogModel.ts b/src/components/image-editor/ImageCanvasGenerationDialogModel.ts index e9707888d..b13778570 100644 --- a/src/components/image-editor/ImageCanvasGenerationDialogModel.ts +++ b/src/components/image-editor/ImageCanvasGenerationDialogModel.ts @@ -1001,11 +1001,11 @@ function createNormalizedGenerationDialogDraft({ 'custom', ); const specType: SpecGenerationType = - specTypeValue === 'character' || - specTypeValue === 'ui' || - specTypeValue === 'icon' - ? specTypeValue - : 'custom'; + specTypeValue === 'ui' + ? 'icon' + : specTypeValue === 'character' || specTypeValue === 'icon' + ? specTypeValue + : 'custom'; return placeDraftBesideSourceLayer( { ...createSpecDialogDraft({ canvasSize, viewport, specType }),