Files
Genarrative/packages/shared/src/contracts/match3dWorks.ts
高物 548db78ca7 Update Match3D/image-generation docs & code
Adds/updates documentation, assets and implementation for Match3D and puzzle image generation workflows. Key changes: decision logs and pitfalls updated to prefer VectorEngine Gemini for Match3D material sheets and to require edits (multipart) for 1:1 container reference images; guidance added for when to use APIMart vs VectorEngine. .env.example clarified APIMart/Responses config. Many new public assets and PPT visuals added. Code changes across frontend and backend: updated shared contracts, server-rs match3d/puzzle/image-generation handlers, VectorEngine/OpenAI image generation clients, and multiple React components/tests to handle UI/background/container image signing, edits workflow, and puzzle UI background resolution. Added src/services/puzzle-runtime/puzzleUiBackgroundSource.ts and related test updates. Includes notes about multipart HTTP/1.1 requirement and test/verification commands in docs.
2026-05-14 20:34:45 +08:00

183 lines
4.6 KiB
TypeScript

/**
* 抓大鹅 Match3D 作品读写共享契约。
* 首版作品发布必须补齐游戏名称、标签、封面、题材、消除次数和难度。
*/
import type { CreationAudioAsset } from './creationAudio';
export type Match3DWorkPublicationStatus = 'draft' | 'published' | string;
export type Match3DGeneratedItemAssetStatus =
| 'pending'
| 'image_ready'
| 'model_generating'
| 'model_ready'
| 'failed'
| string;
export interface Match3DGeneratedBackgroundAsset {
prompt: string;
imageSrc?: string | null;
imageObjectKey?: string | null;
containerPrompt?: string | null;
containerImageSrc?: string | null;
containerImageObjectKey?: string | null;
status: string;
error?: string | null;
}
export interface Match3DGeneratedItemImageView {
viewId: string;
viewIndex: number;
imageSrc?: string | null;
imageObjectKey?: string | null;
}
export interface Match3DGeneratedItemAsset {
itemId: string;
itemName: string;
imageSrc?: string | null;
imageObjectKey?: string | null;
imageViews?: Match3DGeneratedItemImageView[];
modelSrc?: string | null;
modelObjectKey?: string | null;
modelFileName?: string | null;
taskUuid?: string | null;
subscriptionKey?: string | null;
soundPrompt?: string | null;
backgroundMusicTitle?: string | null;
backgroundMusicStyle?: string | null;
backgroundMusicPrompt?: string | null;
backgroundMusic?: CreationAudioAsset | null;
clickSound?: CreationAudioAsset | null;
backgroundAsset?: Match3DGeneratedBackgroundAsset | null;
status: Match3DGeneratedItemAssetStatus;
error?: string | null;
}
export interface PutMatch3DAudioAssetsRequest {
generatedItemAssets: Match3DGeneratedItemAsset[];
}
export interface PersistMatch3DGeneratedModelRequest {
itemId: string;
itemName: string;
sourceUrl: string;
fileName?: string | null;
taskUuid?: string | null;
subscriptionKey?: string | null;
}
export interface PersistMatch3DGeneratedModelResponse {
asset: Match3DGeneratedItemAsset;
}
export interface GenerateMatch3DCoverImageRequest {
prompt: string;
uploadedImageSrc?: string | null;
referenceImageSrc?: string | null;
referenceImageSrcs?: string[];
}
export interface GenerateMatch3DCoverImageResponse {
item: Match3DWorkProfile;
coverImageSrc: string;
coverImageObjectKey: string;
prompt: string;
}
export interface GenerateMatch3DBackgroundImageRequest {
prompt: string;
}
export interface GenerateMatch3DBackgroundImageResponse {
item: Match3DWorkProfile;
backgroundImageSrc: string;
backgroundImageObjectKey: string;
generatedBackgroundAsset: Match3DGeneratedBackgroundAsset;
prompt: string;
}
export interface GenerateMatch3DContainerImageRequest {
prompt: string;
}
export interface GenerateMatch3DContainerImageResponse {
item: Match3DWorkProfile;
containerImageSrc: string;
containerImageObjectKey: string;
generatedBackgroundAsset: Match3DGeneratedBackgroundAsset;
prompt: string;
}
export type GenerateMatch3DItemAssetsMode = 'append' | 'replace';
export interface GenerateMatch3DItemAssetsRequest {
itemNames: string[];
mode?: GenerateMatch3DItemAssetsMode;
}
export interface GenerateMatch3DItemAssetsResponse {
item: Match3DWorkProfile;
generatedItemAssets: Match3DGeneratedItemAsset[];
}
export interface PutMatch3DWorkRequest {
gameName: string;
themeText?: string;
summary: string;
tags: string[];
coverImageSrc?: string | null;
referenceImageSrc?: string | null;
clearCount: number;
difficulty: number;
}
export interface GenerateMatch3DWorkTagsRequest {
gameName: string;
themeText: string;
summary?: string | null;
}
export interface GenerateMatch3DWorkTagsResponse {
tags: string[];
}
export interface Match3DWorkSummary {
workId: string;
profileId: string;
ownerUserId: string;
sourceSessionId?: string | null;
gameName: string;
themeText: string;
summary: string;
tags: string[];
coverImageSrc?: string | null;
referenceImageSrc?: string | null;
clearCount: number;
difficulty: number;
publicationStatus: Match3DWorkPublicationStatus;
playCount: number;
updatedAt: string;
publishedAt?: string | null;
publishReady: boolean;
backgroundPrompt?: string | null;
backgroundImageSrc?: string | null;
backgroundImageObjectKey?: string | null;
generatedBackgroundAsset?: Match3DGeneratedBackgroundAsset | null;
generatedItemAssets?: Match3DGeneratedItemAsset[];
}
export interface Match3DWorkProfile extends Match3DWorkSummary {}
export interface Match3DWorksResponse {
items: Match3DWorkSummary[];
}
export interface Match3DWorkDetailResponse {
item: Match3DWorkProfile;
}
export interface Match3DWorkMutationResponse {
item: Match3DWorkProfile;
}