86 lines
2.3 KiB
TypeScript
86 lines
2.3 KiB
TypeScript
export const BABY_LOVE_DRAWING_TEMPLATE_ID = 'baby-love-drawing';
|
|
export const BABY_LOVE_DRAWING_TEMPLATE_NAME = '宝贝爱画';
|
|
export const BABY_LOVE_DRAWING_EDUTAINMENT_TAG = '寓教于乐';
|
|
|
|
export type BabyLoveDrawingTemplateId =
|
|
typeof BABY_LOVE_DRAWING_TEMPLATE_ID;
|
|
|
|
export type BabyLoveDrawingTool = 'brush' | 'eraser';
|
|
|
|
export type BabyLoveDrawingSaveMode =
|
|
| 'original-only'
|
|
| 'original-and-magic';
|
|
|
|
export type BabyLoveDrawingGenerationProvider =
|
|
| 'vector-engine-gpt-image-2'
|
|
| 'local-demo';
|
|
|
|
export type BabyLoveDrawingPoint = {
|
|
x: number;
|
|
y: number;
|
|
t: number;
|
|
};
|
|
|
|
export type BabyLoveDrawingStroke = {
|
|
strokeId: string;
|
|
tool: BabyLoveDrawingTool;
|
|
color: string;
|
|
points: BabyLoveDrawingPoint[];
|
|
};
|
|
|
|
export type BabyLoveDrawingRecord = {
|
|
drawingId: string;
|
|
templateId: BabyLoveDrawingTemplateId;
|
|
templateName: typeof BABY_LOVE_DRAWING_TEMPLATE_NAME;
|
|
originalImageSrc: string;
|
|
magicImageSrc: string | null;
|
|
strokeTrace: BabyLoveDrawingStroke[];
|
|
saveMode: BabyLoveDrawingSaveMode;
|
|
themeTags: string[];
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
};
|
|
|
|
export type CreateBabyLoveDrawingMagicRequest = {
|
|
originalImageSrc: string;
|
|
strokeTrace: BabyLoveDrawingStroke[];
|
|
};
|
|
|
|
export type CreateBabyLoveDrawingMagicResponse = {
|
|
magicImageSrc: string;
|
|
generationProvider: BabyLoveDrawingGenerationProvider;
|
|
prompt: string;
|
|
};
|
|
|
|
export type SaveBabyLoveDrawingRequest = {
|
|
originalImageSrc: string;
|
|
magicImageSrc?: string | null;
|
|
strokeTrace: BabyLoveDrawingStroke[];
|
|
};
|
|
|
|
export type SaveBabyLoveDrawingResponse = {
|
|
record: BabyLoveDrawingRecord;
|
|
};
|
|
|
|
export const BABY_LOVE_DRAWING_RAINBOW_COLORS = [
|
|
{ id: 'red', label: '红', value: '#ef4444' },
|
|
{ id: 'orange', label: '橙', value: '#f97316' },
|
|
{ id: 'yellow', label: '黄', value: '#facc15' },
|
|
{ id: 'green', label: '绿', value: '#22c55e' },
|
|
{ id: 'cyan', label: '青', value: '#06b6d4' },
|
|
{ id: 'blue', label: '蓝', value: '#3b82f6' },
|
|
{ id: 'purple', label: '紫', value: '#a855f7' },
|
|
] as const;
|
|
|
|
export type BabyLoveDrawingRainbowColorId =
|
|
(typeof BABY_LOVE_DRAWING_RAINBOW_COLORS)[number]['id'];
|
|
|
|
export function normalizeBabyLoveDrawingTags(tags: string[]) {
|
|
return [
|
|
...new Set([
|
|
BABY_LOVE_DRAWING_EDUTAINMENT_TAG,
|
|
...tags.map((tag) => tag.trim()).filter(Boolean),
|
|
]),
|
|
];
|
|
}
|