140 lines
3.0 KiB
TypeScript
140 lines
3.0 KiB
TypeScript
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 WebhookLastStatus = {
|
|
ok: boolean;
|
|
status?: number;
|
|
error?: string;
|
|
attemptedAt: string;
|
|
nextAttemptAt?: string;
|
|
};
|
|
|
|
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;
|
|
externalClientId?: 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;
|
|
idempotencyKey?: string;
|
|
idempotencyFingerprint?: string;
|
|
priority?: number;
|
|
attempts?: number;
|
|
maxAttempts?: number;
|
|
scheduledAt?: string;
|
|
lockedAt?: string;
|
|
lockedBy?: string;
|
|
startedAt?: string;
|
|
completedAt?: string;
|
|
webhookUrl?: string;
|
|
webhookAttempts?: number;
|
|
webhookLastStatus?: WebhookLastStatus;
|
|
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;
|
|
};
|