diff --git a/server-rs/crates/api-server/src/editor_project.rs b/server-rs/crates/api-server/src/editor_project.rs index 3690fa81b..285d0885e 100644 --- a/server-rs/crates/api-server/src/editor_project.rs +++ b/server-rs/crates/api-server/src/editor_project.rs @@ -2481,8 +2481,7 @@ fn build_editor_scene_generation_inputs( .map(str::trim) .filter(|value| !value.is_empty()) { - fields - .push(json!({ "id": "customStyle", "title": "自定义画风", "value": custom_style })); + fields.push(json!({ "id": "customStyle", "title": "自定义画风", "value": custom_style })); } json!({ "version": 2, @@ -6292,6 +6291,7 @@ async fn resolve_editor_pixel_art_source_for_owner( )?; let generation_input_reference = if let Some(source_resource) = source_resource { Some(json!({ + "id": "source", "title": "原图", "label": source_resource .label @@ -6305,6 +6305,7 @@ async fn resolve_editor_pixel_art_source_for_owner( editor_generation_reference_from_records( projects.as_slice(), library.assets.as_slice(), + Some("source"), "原图".to_string(), source, ) @@ -6312,6 +6313,7 @@ async fn resolve_editor_pixel_art_source_for_owner( editor_generation_reference_from_records( projects.as_slice(), library.assets.as_slice(), + Some("source"), "原图".to_string(), object_key.as_str(), ) @@ -8544,9 +8546,7 @@ pub(crate) async fn rebuild_editor_generation_input_references( editor_generation_reference_from_records( projects.as_slice(), library.assets.as_slice(), - reference_slot_ids - .get(index) - .and_then(|id| id.as_deref()), + reference_slot_ids.get(index).and_then(|id| id.as_deref()), title, source.as_str(), ) @@ -13566,27 +13566,32 @@ mod tests { let resource_reference = editor_generation_reference_from_records( projects.as_slice(), std::slice::from_ref(&asset), + Some("specReference"), "参考图 1".to_string(), "generated-character-drafts/editor/shared.png", ) .expect("owned resource object key should produce provenance"); assert_eq!(resource_reference["refType"], "project-resource"); assert_eq!(resource_reference["refId"], "resource-1"); + assert_eq!(resource_reference["id"], "specReference"); let asset_reference = editor_generation_reference_from_records( projects.as_slice(), std::slice::from_ref(&asset), + Some("reference"), "参考图 2".to_string(), "asset-1", ) .expect("owned asset id should produce provenance"); assert_eq!(asset_reference["refType"], "asset"); assert_eq!(asset_reference["refId"], "asset-1"); + assert_eq!(asset_reference["id"], "reference"); assert!( editor_generation_reference_from_records( projects.as_slice(), std::slice::from_ref(&asset), + Some("reference"), "参考图 3".to_string(), "asset-forged", ) diff --git a/src/components/image-editor/ImageCanvasEditorGenerationIntegration.test.tsx b/src/components/image-editor/ImageCanvasEditorGenerationIntegration.test.tsx index 04e6af030..7f2ef9a4c 100644 --- a/src/components/image-editor/ImageCanvasEditorGenerationIntegration.test.tsx +++ b/src/components/image-editor/ImageCanvasEditorGenerationIntegration.test.tsx @@ -2241,9 +2241,20 @@ describe('ImageCanvasEditorView generation integration', () => { projectId: 'editor-project-default', assetFolderId: 'project', generationInputs: { + version: 2, + action: 'spec.generate', fields: [ - { title: '玩法设定', value: '消除类派对玩法' }, - { title: '美术风格', value: '糖果玻璃拟物' }, + { id: 'specType', title: '规范类型', value: 'icon' }, + { + id: 'playSetting', + title: '玩法设定', + value: '消除类派对玩法', + }, + { + id: 'artStyle', + title: '美术风格', + value: '糖果玻璃拟物', + }, ], references: [], }, @@ -3165,9 +3176,16 @@ describe('ImageCanvasEditorView generation integration', () => { projectId: 'editor-project-default', assetFolderId: 'project', generationInputs: { + version: 2, + action: 'spec.generate', fields: [ - { title: '玩法设定', value: '背包整理玩法' }, - { title: '美术风格', value: '清爽卡通' }, + { id: 'specType', title: '规范类型', value: 'icon' }, + { + id: 'playSetting', + title: '玩法设定', + value: '背包整理玩法', + }, + { id: 'artStyle', title: '美术风格', value: '清爽卡通' }, ], references: [], }, diff --git a/src/components/image-editor/ImageCanvasExportModel.ts b/src/components/image-editor/ImageCanvasExportModel.ts index 6865ebb55..020bb627f 100644 --- a/src/components/image-editor/ImageCanvasExportModel.ts +++ b/src/components/image-editor/ImageCanvasExportModel.ts @@ -8,6 +8,7 @@ import type { import { DEFAULT_ICON_DESCRIPTIONS, formatEditorGenerationInputFieldValue, + formatGenerationInputValue, formatLayerImageType, getEditorLayerModelDisplayName, isEditorUserVisibleGenerationInputField, diff --git a/src/components/image-editor/useImageCanvasGenerationSubmissionWorkflow.test.tsx b/src/components/image-editor/useImageCanvasGenerationSubmissionWorkflow.test.tsx index 875a0f463..fb1e8ec49 100644 --- a/src/components/image-editor/useImageCanvasGenerationSubmissionWorkflow.test.tsx +++ b/src/components/image-editor/useImageCanvasGenerationSubmissionWorkflow.test.tsx @@ -2395,7 +2395,7 @@ describe('useImageCanvasGenerationSubmissionWorkflow', () => { expect(screen.getByTestId('sound-effect-assist').textContent).toBe( 'idle', ); - expect(screen.getByTestId('layers').textContent).not.toContain( + expect(screen.getByTestId('layers').textContent).toContain( 'sound-effect', ); });