完善快速编辑参考图与生成占位
- 快速编辑支持最多8张额外参考图,并将原图自动作为最后一张参考图提交 - 快速编辑尺寸和模型沿用原图配置,按禁用态参数胶囊展示 - 快速编辑提交前同步改写原图引用为实际图序号 - 快速编辑生成改为创建独立画布生成占位,并支持键盘删除生成中对象 - 对齐生成类面板参考图图标、规范类固定参数和相关文档测试
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
buildEditGenerationInputs,
|
||||
buildIconGenerationInputs,
|
||||
buildImageGenerationInputs,
|
||||
buildQuickEditGenerationInputs,
|
||||
buildQuickEditModelOptions,
|
||||
buildSoundEffectGenerationInputs,
|
||||
buildSpecGenerationInputs,
|
||||
@@ -17,6 +18,7 @@ import {
|
||||
DEFAULT_IMAGE_MODEL,
|
||||
getGenerationFrameAriaLabel,
|
||||
getGenerationFrameLabel,
|
||||
normalizeQuickEditPromptSourceReference,
|
||||
resolveCharacterAnimationSourceImageSrc,
|
||||
resolveImageGenerationErrorMessage,
|
||||
} from './ImageCanvasGenerationModel';
|
||||
@@ -59,7 +61,7 @@ describe('ImageCanvasGenerationModel', () => {
|
||||
).toEqual({
|
||||
fields: [{ title: '角色设定', value: '主角骑士' }],
|
||||
references: [
|
||||
{ title: '角色形象规范', label: '角色规范', src: '/spec.png' },
|
||||
{ title: '角色规范', label: '角色规范', src: '/spec.png' },
|
||||
{ title: '常规参考图 1', label: '盔甲参考', src: '/armor.png' },
|
||||
],
|
||||
});
|
||||
@@ -75,7 +77,7 @@ describe('ImageCanvasGenerationModel', () => {
|
||||
{ title: '素材描述', value: '返回按钮\n设置按钮' },
|
||||
],
|
||||
references: [
|
||||
{ title: '图标素材规范', label: '图标规范', src: '/icon-spec.png' },
|
||||
{ title: '图标规范', label: '图标规范', src: '/icon-spec.png' },
|
||||
],
|
||||
});
|
||||
|
||||
@@ -87,6 +89,35 @@ describe('ImageCanvasGenerationModel', () => {
|
||||
{ title: '参考图', label: '原图', src: '/source.png' },
|
||||
],
|
||||
});
|
||||
expect(
|
||||
buildQuickEditGenerationInputs('快速编辑提示词', '让图2下雨', sourceLayer, [
|
||||
{ id: 'ref-1', label: '天空', src: '/sky.png' },
|
||||
]),
|
||||
).toEqual({
|
||||
fields: [{ title: '快速编辑提示词', value: '让图2下雨' }],
|
||||
references: [
|
||||
{ title: '参考图 1', label: '天空', src: '/sky.png' },
|
||||
{ title: '参考图 2', label: '原图', src: '/source.png' },
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it('rewrites quick edit source image references to the final image index', () => {
|
||||
expect(normalizeQuickEditPromptSourceReference('把图1改成夜晚', 3)).toBe(
|
||||
'把图3改成夜晚',
|
||||
);
|
||||
expect(normalizeQuickEditPromptSourceReference('参考原图增加暖光', 2)).toBe(
|
||||
'参考图2增加暖光',
|
||||
);
|
||||
expect(normalizeQuickEditPromptSourceReference('保留图1构图', 1)).toBe(
|
||||
'保留图1构图',
|
||||
);
|
||||
expect(
|
||||
normalizeQuickEditPromptSourceReference('保持当前图片构图', 1),
|
||||
).toBe('保持图1构图');
|
||||
expect(
|
||||
normalizeQuickEditPromptSourceReference('不要影响图10内容', 2),
|
||||
).toBe('不要影响图10内容');
|
||||
});
|
||||
|
||||
it('keeps generated prompts and quick edit options stable', () => {
|
||||
@@ -166,6 +197,15 @@ describe('ImageCanvasGenerationModel', () => {
|
||||
|
||||
expect(getGenerationFrameAriaLabel(iconDialog)).toBe('图标素材生成占位图');
|
||||
expect(getGenerationFrameLabel(iconDialog)).toBe('Icon Generator');
|
||||
expect(
|
||||
getGenerationFrameAriaLabel({
|
||||
...iconDialog,
|
||||
mode: 'quick-edit',
|
||||
}),
|
||||
).toBe('快速编辑生成占位图');
|
||||
expect(getGenerationFrameLabel({ ...iconDialog, mode: 'quick-edit' })).toBe(
|
||||
'Quick Edit Generator',
|
||||
);
|
||||
expect(
|
||||
buildSoundEffectGenerationInputs('金币掉落叮当声', 'one-shot', null),
|
||||
).toEqual({
|
||||
|
||||
Reference in New Issue
Block a user