From d5f0f6de93764f16a48c11bf1e1d4408a0c01894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 8 Aug 2026 11:15:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E7=94=9F?= =?UTF-8?q?=E6=88=90=E8=BE=93=E5=85=A5=E5=A5=91=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 场景请求提交前将画布参数转换为字符串契约 保留素材结果中的原始画布参数类型 --- .../ImageCanvasGenerationSubmissionModel.ts | 26 ++++++++++++++++++- ...ImageCanvasGenerationSubmissionWorkflow.ts | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/components/image-editor/ImageCanvasGenerationSubmissionModel.ts b/src/components/image-editor/ImageCanvasGenerationSubmissionModel.ts index be9e4fe2d..aaef7ff65 100644 --- a/src/components/image-editor/ImageCanvasGenerationSubmissionModel.ts +++ b/src/components/image-editor/ImageCanvasGenerationSubmissionModel.ts @@ -2,6 +2,7 @@ import { CUSTOM_EDITOR_SCENE_STYLE_PRESET, DEFAULT_EDITOR_SCENE_STYLE_PRESET, } from '../../../packages/shared/src/contracts/editorScene'; +import type { EditorSceneGenerationInputs } from '../../../packages/shared/src/contracts/editorScene'; import type { EditorBackgroundMusicGenerationInput, EditorCharacterAnimationGenerationInput, @@ -75,6 +76,29 @@ export const EDITOR_SCENE_CUSTOM_STYLE_REQUIRED_ERROR = '请填写自定义画 export const EDITOR_GENERATED_ASSET_LABEL_MAX_CHARS = 80; +/** + * 场景生成接口的历史契约只接受字符串参数;画布配方则保留原生 + * string | number | boolean 值,以便在素材元数据中无损回放。 + */ +export function toEditorSceneGenerationInputs( + generationInputs: CanvasGenerationInputs, +): EditorSceneGenerationInputs { + return { + fields: generationInputs.fields.map(({ title, value }) => ({ + title, + value: String(value), + })), + references: generationInputs.references.map( + ({ title, label, refType, refId }) => ({ + title, + label: label ?? '', + refType, + refId, + }), + ), + }; +} + export function resolveGenerationAssetLabel( assetLabel: string | null | undefined, fallback: string, @@ -628,7 +652,7 @@ export function buildImageGenerationSubmissionPlan({ ), } : {}), - generationInputs, + generationInputs: toEditorSceneGenerationInputs(generationInputs), }, result: { assetKind: 'scene', diff --git a/src/components/image-editor/useImageCanvasGenerationSubmissionWorkflow.ts b/src/components/image-editor/useImageCanvasGenerationSubmissionWorkflow.ts index 74d098a65..c041e80c7 100644 --- a/src/components/image-editor/useImageCanvasGenerationSubmissionWorkflow.ts +++ b/src/components/image-editor/useImageCanvasGenerationSubmissionWorkflow.ts @@ -2373,7 +2373,7 @@ export function useImageCanvasGenerationSubmissionWorkflow({ generateEditorScene({ ...sceneGenerationInput, projectId, - generationInputs: submissionPlan.result.generationInputs, + generationInputs: submissionPlan.input.generationInputs, assetFolderId, assetLabel: submissionPlan.result.title, ...(projectId && canvasCompletionPlaceholder