修复画布生成参数复用问题

强化持久化生成输入的运行时结构校验
统一快速编辑请求尺寸、模型、参考图与生成快照
补齐视频联网搜索参数保存与恢复
隐藏缺少必需来源的复用参数入口
补充回归测试并同步编辑器方案文档
This commit is contained in:
2026-08-04 14:38:56 +08:00
parent d0fedd1d99
commit a9b462d43f
10 changed files with 339 additions and 27 deletions
@@ -860,6 +860,7 @@ describe('ImageCanvasGenerationDialogModel', () => {
{ id: 'resolution', title: '显示快照', value: '1080p' },
{ id: 'durationSeconds', title: '显示快照', value: 8 },
{ id: 'sound', title: '显示快照', value: 'off' },
{ id: 'webSearchEnabled', title: '显示快照', value: false },
],
references: [
{
@@ -888,6 +889,7 @@ describe('ImageCanvasGenerationDialogModel', () => {
videoResolution: '1080p',
videoDurationSeconds: 8,
videoSound: 'off',
videoWebSearchEnabled: false,
generationReferences: [
expect.objectContaining({
id: 'canvas-layer-image-reference',
@@ -1005,6 +1007,67 @@ describe('ImageCanvasGenerationDialogModel', () => {
});
});
it('restores quick-edit references and the persisted image model', () => {
const editSource = createLayer({
id: 'layer-edit-source',
resourceId: 'resource-edit-source',
});
const styleReference = createLayer({
id: 'layer-style-reference',
resourceId: 'resource-style-reference',
title: '风格参考',
});
expect(
createLayerGenerationDialogDraft({
sourceLayer: createLayer({
id: 'layer-edit-result',
resourceId: 'resource-edit-result',
sourceType: 'generated',
generationInputs: {
version: 2,
action: 'image.edit',
fields: [
{ id: 'prompt', title: '提示词', value: '改成雨天' },
{ id: 'model', title: '模型', value: IMAGE_MODEL_NANOBANANA2 },
{ id: 'aspectRatio', title: '比例', value: '16:9' },
{ id: 'imageSize', title: '尺寸', value: '2K' },
],
references: [
{
id: 'source',
title: '原图',
refType: 'project-resource',
refId: 'resource-edit-source',
},
{
id: 'reference',
title: '参考图 1',
refType: 'project-resource',
refId: 'resource-style-reference',
},
],
},
}),
availableLayers: [editSource, styleReference],
canvasSize: { width: 960, height: 720 },
viewport: { x: 0, y: 0, scale: 1 },
}),
).toMatchObject({
mode: 'quick-edit',
prompt: '改成雨天',
imageModel: IMAGE_MODEL_NANOBANANA2,
aspectRatio: '16:9',
imageSize: '2K',
generationReferences: [
expect.objectContaining({
id: 'canvas-layer-style-reference',
label: '风格参考',
}),
],
});
});
it('uses the V2 source reference ahead of a conflicting legacy animation source', () => {
const v2Source = createLayer({
id: 'layer-v2-character',