Initial 智念AIGC platform
This commit is contained in:
117
lib/types.ts
Normal file
117
lib/types.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
export type ImageCapability =
|
||||
| "image.generate"
|
||||
| "image.inpaint"
|
||||
| "image.upscale";
|
||||
|
||||
export type EnabledImageCapability = ImageCapability;
|
||||
|
||||
export type VideoCapability = "video.generate";
|
||||
|
||||
export type GenerationCapability = ImageCapability | VideoCapability;
|
||||
|
||||
export type AssetKind = "image" | "video" | "mask" | "reference" | "other";
|
||||
|
||||
export type GenerationStatus =
|
||||
| "queued"
|
||||
| "running"
|
||||
| "succeeded"
|
||||
| "failed"
|
||||
| "expired"
|
||||
| "cancelled";
|
||||
|
||||
export type Asset = {
|
||||
id: string;
|
||||
ownerId: string;
|
||||
kind: AssetKind;
|
||||
name: string;
|
||||
url: string;
|
||||
storagePath?: string;
|
||||
source: "upload" | "generated" | "edited" | "upscaled" | "external" | "seed";
|
||||
tags: string[];
|
||||
metadata: Record<string, unknown>;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type GenerationJob = {
|
||||
id: string;
|
||||
ownerId: string;
|
||||
capability: GenerationCapability;
|
||||
provider: "volcengine-visual" | "evolink" | "seedance" | "mock";
|
||||
reqKey: string;
|
||||
status: GenerationStatus;
|
||||
prompt?: string;
|
||||
inputAssetIds: string[];
|
||||
inputUrls: string[];
|
||||
outputAssetIds: string[];
|
||||
providerTaskId?: string;
|
||||
requestPayload: Record<string, unknown>;
|
||||
responsePayload?: Record<string, unknown>;
|
||||
error?: {
|
||||
code?: string | number;
|
||||
message: string;
|
||||
retryable?: boolean;
|
||||
};
|
||||
retryOf?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type UsageEvent = {
|
||||
id: string;
|
||||
ownerId: string;
|
||||
jobId: string;
|
||||
capability: GenerationCapability;
|
||||
quantity: number;
|
||||
estimatedUnit: "image" | "job";
|
||||
createdAt: string;
|
||||
};
|
||||
|
||||
export type Project = {
|
||||
id: string;
|
||||
ownerId: string;
|
||||
name: string;
|
||||
brief: string;
|
||||
type: "brand" | "store" | "commerce" | "event" | "course" | "ip" | "custom";
|
||||
assetIds: string[];
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type AppState = {
|
||||
users: Array<{
|
||||
id: string;
|
||||
email: string;
|
||||
displayName: string;
|
||||
}>;
|
||||
assets: Asset[];
|
||||
generationJobs: GenerationJob[];
|
||||
usageEvents: UsageEvent[];
|
||||
projects: Project[];
|
||||
};
|
||||
|
||||
export type VisualTaskSubmitResponse = {
|
||||
code: number;
|
||||
message: string;
|
||||
request_id?: string;
|
||||
data?: {
|
||||
task_id?: string;
|
||||
} | null;
|
||||
status?: number;
|
||||
time_elapsed?: string;
|
||||
};
|
||||
|
||||
export type VisualTaskQueryResponse = {
|
||||
code: number;
|
||||
message: string;
|
||||
request_id?: string;
|
||||
task_id?: string;
|
||||
data?: {
|
||||
binary_data_base64?: string[] | null;
|
||||
image_urls?: string[] | null;
|
||||
status?: "in_queue" | "generating" | "done" | "not_found" | "expired";
|
||||
resp_data?: string;
|
||||
} | null;
|
||||
status?: number;
|
||||
time_elapsed?: string;
|
||||
};
|
||||
Reference in New Issue
Block a user