feat: add edutainment drawing and visual package flows
This commit is contained in:
85
packages/shared/src/contracts/edutainmentBabyDrawing.ts
Normal file
85
packages/shared/src/contracts/edutainmentBabyDrawing.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
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),
|
||||
]),
|
||||
];
|
||||
}
|
||||
@@ -2,8 +2,7 @@ export const BABY_OBJECT_MATCH_TEMPLATE_ID = 'baby-object-match';
|
||||
export const BABY_OBJECT_MATCH_TEMPLATE_NAME = '宝贝识物';
|
||||
export const BABY_OBJECT_MATCH_EDUTAINMENT_TAG = '寓教于乐';
|
||||
|
||||
export type BabyObjectMatchTemplateId =
|
||||
typeof BABY_OBJECT_MATCH_TEMPLATE_ID;
|
||||
export type BabyObjectMatchTemplateId = typeof BABY_OBJECT_MATCH_TEMPLATE_ID;
|
||||
|
||||
export type BabyObjectMatchAssetProvider =
|
||||
| 'vector-engine-gpt-image-2'
|
||||
@@ -20,6 +19,27 @@ export type BabyObjectMatchItemAsset = {
|
||||
prompt: string;
|
||||
};
|
||||
|
||||
export type BabyObjectMatchVisualAssetKind =
|
||||
| 'background'
|
||||
| 'ui-frame'
|
||||
| 'gift-box'
|
||||
| 'basket'
|
||||
| 'smoke-puff';
|
||||
|
||||
export type BabyObjectMatchVisualAsset = {
|
||||
assetId: string;
|
||||
assetKind: BabyObjectMatchVisualAssetKind;
|
||||
imageSrc: string;
|
||||
assetObjectId: string | null;
|
||||
generationProvider: BabyObjectMatchAssetProvider;
|
||||
prompt: string;
|
||||
};
|
||||
|
||||
export type BabyObjectMatchVisualPackage = {
|
||||
themePrompt: string;
|
||||
assets: BabyObjectMatchVisualAsset[];
|
||||
};
|
||||
|
||||
export type BabyObjectMatchDraft = {
|
||||
draftId: string;
|
||||
profileId: string;
|
||||
@@ -29,6 +49,7 @@ export type BabyObjectMatchDraft = {
|
||||
workDescription: string;
|
||||
itemNames: [string, string];
|
||||
itemAssets: [BabyObjectMatchItemAsset, BabyObjectMatchItemAsset];
|
||||
visualPackage?: BabyObjectMatchVisualPackage | null;
|
||||
themeTags: string[];
|
||||
publicationStatus: BabyObjectMatchPublicationStatus;
|
||||
createdAt: string;
|
||||
@@ -41,6 +62,15 @@ export type CreateBabyObjectMatchDraftRequest = {
|
||||
itemBName: string;
|
||||
};
|
||||
|
||||
export type GenerateBabyObjectMatchAssetsRequest = {
|
||||
itemNames: [string, string];
|
||||
};
|
||||
|
||||
export type GenerateBabyObjectMatchAssetsResponse = {
|
||||
assets: [BabyObjectMatchItemAsset, BabyObjectMatchItemAsset];
|
||||
visualPackage?: BabyObjectMatchVisualPackage | null;
|
||||
};
|
||||
|
||||
export type BabyObjectMatchDraftResponse = {
|
||||
draft: BabyObjectMatchDraft;
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ export type * from './contracts/creationAgentDocumentInput';
|
||||
export type * from './contracts/creationAudio';
|
||||
export type * from './contracts/creativeAgent';
|
||||
export type * from './contracts/customWorldAgent';
|
||||
export * from './contracts/edutainmentBabyDrawing';
|
||||
export * from './contracts/edutainmentBabyObject';
|
||||
export type * from './contracts/hyper3d';
|
||||
export * from './contracts/match3dAgent';
|
||||
|
||||
Reference in New Issue
Block a user