收口图片画布生成模式与工具映射
使用类型完备的 Record 集中维护生成模式与画布工具映射 保留未知运行时模式默认回落到普通图片生成工具的历史行为
This commit is contained in:
@@ -316,34 +316,25 @@ function findSourceAnimationLayer(
|
||||
);
|
||||
}
|
||||
|
||||
const CANVAS_TOOL_BY_GENERATION_MODE = {
|
||||
generate: 'generate',
|
||||
spec: 'spec',
|
||||
character: 'character',
|
||||
icon: 'icon',
|
||||
publication: 'publication',
|
||||
'ui-design': 'ui-design',
|
||||
'quick-edit': 'generate',
|
||||
'character-animation': 'character',
|
||||
video: 'video',
|
||||
'audio-sound-effect': 'music',
|
||||
'audio-background-music': 'music',
|
||||
scene: 'scene',
|
||||
} as const satisfies Record<CanvasGenerationDialogState['mode'], CanvasTool>;
|
||||
|
||||
function getCanvasToolForGenerationMode(
|
||||
mode: CanvasGenerationDialogState['mode'],
|
||||
): CanvasTool {
|
||||
if (mode === 'video') {
|
||||
return 'video';
|
||||
}
|
||||
if (mode === 'scene') {
|
||||
return 'scene';
|
||||
}
|
||||
if (mode === 'audio-sound-effect' || mode === 'audio-background-music') {
|
||||
return 'music';
|
||||
}
|
||||
if (mode === 'character' || mode === 'character-animation') {
|
||||
return 'character';
|
||||
}
|
||||
if (mode === 'icon') {
|
||||
return 'icon';
|
||||
}
|
||||
if (mode === 'publication') {
|
||||
return 'publication';
|
||||
}
|
||||
if (mode === 'ui-design') {
|
||||
return 'ui-design';
|
||||
}
|
||||
if (mode === 'spec') {
|
||||
return 'spec';
|
||||
}
|
||||
return 'generate';
|
||||
return CANVAS_TOOL_BY_GENERATION_MODE[mode] ?? 'generate';
|
||||
}
|
||||
|
||||
const LAST_CHARACTER_SPEC_REFERENCE_CACHE_KEY =
|
||||
|
||||
Reference in New Issue
Block a user