feat: complete TASK-WP2-06 generation terminal states

This commit is contained in:
suyx
2026-08-03 01:06:28 +08:00
parent c8643c080d
commit 2bb4f86d04
18 changed files with 1419 additions and 14 deletions
@@ -1,5 +1,6 @@
import { Type, type Static } from "@sinclair/typebox";
import { GenerationErrorCategorySchema } from "./api.js";
import { ProjectIdSchema, ProjectRatioSchema } from "./projects.js";
const uuidPattern = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$";
@@ -16,12 +17,14 @@ export const GenerationTaskStatusSchema = Type.Union([
export const GenerationTaskResponseSchema = Type.Object({
confirmed_credit_cost: Type.Integer({ minimum: 1 }),
created_at: Type.String({ pattern: isoTimestampPattern }),
error_category: Type.Union([Type.Ref(GenerationErrorCategorySchema), Type.Null()]),
generation_id: Type.String({ pattern: uuidPattern }),
model_config_version: Type.Integer({ minimum: 1 }),
model_id: Type.String({ maxLength: 160, minLength: 1 }),
project_id: Type.Ref(ProjectIdSchema),
prompt: Type.String({ maxLength: 4_000, minLength: 1 }),
ratio: Type.Ref(ProjectRatioSchema),
reference_asset_ids: Type.Array(Type.String({ pattern: uuidPattern }), { maxItems: 16 }),
reference_count: Type.Integer({ minimum: 0 }),
reserved_credits: Type.Integer({ minimum: 0 }),
status: Type.Ref(GenerationTaskStatusSchema),