Files
Genarrative/packages/shared/src/contracts/editorScene.ts
T
kdletters 071faa482c 统一 Rust 与 TypeScript 格式化门禁
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口

完成项目 TypeScript/Prettier 与 Rust 全量格式化

修复 Pingora expected executable 门禁的空白敏感误报

同步开发运维文档与 AGC skill pack 格式化忽略规则
2026-09-01 16:28:34 +08:00

112 lines
2.9 KiB
TypeScript

export const EDITOR_SCENE_STYLE_PRESETS = {
ANIME: {
value: 'anime',
label: '日系动画',
description: '细腻光影、动画感构图',
},
WATERCOLOR: {
value: 'watercolor',
label: '清透水彩',
description: '通透纸感、柔和自然晕染',
},
FLAT: {
value: 'flat',
label: '平面几何',
description: '清晰色块、简化形体与轮廓',
},
STOP_MOTION: {
value: 'stop-motion',
label: '定格模型',
description: '实体模型质感、微缩布景光影',
},
CUSTOM: {
value: 'custom',
label: '自定义',
description: '填写具体画风',
},
} as const;
type EditorSceneStylePresetDefinition =
(typeof EDITOR_SCENE_STYLE_PRESETS)[keyof typeof EDITOR_SCENE_STYLE_PRESETS];
export type EditorSceneStylePreset = EditorSceneStylePresetDefinition['value'];
export const EDITOR_SCENE_STYLE_PRESET_OPTIONS = Object.values(
EDITOR_SCENE_STYLE_PRESETS,
);
export const DEFAULT_EDITOR_SCENE_STYLE_PRESET =
EDITOR_SCENE_STYLE_PRESETS.ANIME.value;
export const CUSTOM_EDITOR_SCENE_STYLE_PRESET =
EDITOR_SCENE_STYLE_PRESETS.CUSTOM.value;
export function isEditorSceneStylePreset(
value: unknown,
): value is EditorSceneStylePreset {
return EDITOR_SCENE_STYLE_PRESET_OPTIONS.some(
(preset) => preset.value === value,
);
}
export function getEditorSceneStylePresetLabel(value: EditorSceneStylePreset) {
return (
EDITOR_SCENE_STYLE_PRESET_OPTIONS.find((preset) => preset.value === value)
?.label ?? EDITOR_SCENE_STYLE_PRESETS.ANIME.label
);
}
export function resolveEditorSceneStylePresetByLabel(
label: string | null | undefined,
): EditorSceneStylePreset {
return (
EDITOR_SCENE_STYLE_PRESET_OPTIONS.find((preset) => preset.label === label)
?.value ?? DEFAULT_EDITOR_SCENE_STYLE_PRESET
);
}
export type EditorSceneGenerationPlaceholder = {
x: number;
y: number;
width: number;
height: number;
originalWidth: number;
originalHeight: number;
};
export type EditorSceneGenerationCompletion = {
dialogId?: string;
title: string;
placeholder: EditorSceneGenerationPlaceholder;
};
export type EditorSceneGenerationInputField = {
title: string;
value: string;
};
export type EditorSceneGenerationInputReference = {
title: string;
label: string;
refType: 'project-resource' | 'asset';
refId: string;
};
export type EditorSceneGenerationInputs = {
fields: EditorSceneGenerationInputField[];
references: EditorSceneGenerationInputReference[];
};
export type EditorSceneGenerationRequest = {
sceneContent: string;
stylePreset: EditorSceneStylePreset;
customStyle?: string | null;
model?: string;
aspectRatio?: string;
imageSize?: string;
referenceImageSrcs?: string[];
projectId?: string | null;
generationInputs?: EditorSceneGenerationInputs | null;
assetFolderId?: string | null;
assetLabel?: string | null;
canvasCompletion?: EditorSceneGenerationCompletion | null;
};