Add UI-design asset extraction & spritesheet support
Introduce a new UI design asset extraction flow: add POST /api/editor/ui-designs/assets/extractions handler that always uses gpt-image-2 with the fixed prompt "提取画面中的所有独立并整理成spritesheet"; parse Data URL references, call OpenAI image edits, return a spritesheet and sliced icon assets. Increase request body limit for image Data URLs and wire the route with bearer auth. Add platform-image slicing: slice_generated_icon_spritesheet_all_by_connected_components (with auto-naming "素材 1..N", foreground estimation and heuristics) and export it. Add Rust tests for the handler, prompt constant, and slicing behavior. Update frontend client and integration tests to call the new extractEditorUiDesignAssets API and verify spritesheet + icon layers are added to the canvas and persisted. Update multiple docs to describe the extraction UI, toolbar placement, and related audio/playback pitfalls. Minor related updates: toolbar button ordering and audio duration / signed read-url notes.
This commit is contained in:
@@ -220,31 +220,42 @@ describe('ImageCanvasGenerationLayerModel', () => {
|
||||
generationInputs: createGenerationInputs(),
|
||||
});
|
||||
|
||||
expect(layers).toHaveLength(3);
|
||||
expect(layers).toHaveLength(4);
|
||||
expect(layers[0]).toMatchObject({
|
||||
id: 'layer-icon-11',
|
||||
title: '返回按钮',
|
||||
id: 'layer-icon-spritesheet-11',
|
||||
title: '图标素材图集 11',
|
||||
x: 200,
|
||||
y: 100,
|
||||
width: 512,
|
||||
height: 512,
|
||||
assetKind: 'icon-spritesheet',
|
||||
prompt: '图标 prompt',
|
||||
actualPrompt: '图标 actual prompt',
|
||||
});
|
||||
expect(layers[1]).toMatchObject({
|
||||
id: 'layer-icon-12',
|
||||
title: '返回按钮',
|
||||
x: 744,
|
||||
y: 100,
|
||||
width: 256,
|
||||
height: 256,
|
||||
assetKind: 'icon',
|
||||
prompt: '图标 prompt',
|
||||
actualPrompt: '图标 actual prompt',
|
||||
});
|
||||
expect(layers[1]).toMatchObject({
|
||||
id: 'layer-icon-12',
|
||||
expect(layers[2]).toMatchObject({
|
||||
id: 'layer-icon-13',
|
||||
title: '设置按钮',
|
||||
x: 200,
|
||||
x: 744,
|
||||
y: 380,
|
||||
width: 512,
|
||||
height: 256,
|
||||
assetKind: 'icon',
|
||||
});
|
||||
expect(layers[2]).toMatchObject({
|
||||
id: 'layer-icon-13',
|
||||
expect(layers[3]).toMatchObject({
|
||||
id: 'layer-icon-14',
|
||||
title: '提示按钮',
|
||||
x: 200,
|
||||
x: 744,
|
||||
y: 660,
|
||||
width: 128,
|
||||
height: 128,
|
||||
@@ -266,6 +277,7 @@ describe('ImageCanvasGenerationLayerModel', () => {
|
||||
taskId: 'sound-task-1',
|
||||
priceMudPoints: 10,
|
||||
audioKind: 'sound-effect',
|
||||
durationSeconds: 75,
|
||||
},
|
||||
generatedIndex: 14,
|
||||
title: '游戏音效 14',
|
||||
@@ -303,6 +315,7 @@ describe('ImageCanvasGenerationLayerModel', () => {
|
||||
model: 'audio1.0',
|
||||
provider: 'VectorEngine',
|
||||
taskId: 'sound-task-1',
|
||||
durationSeconds: 75,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user