feat: complete TASK-WP2-05 generation submission

This commit is contained in:
suyx
2026-08-03 00:26:34 +08:00
parent 4551d73e76
commit c8643c080d
22 changed files with 2372 additions and 22 deletions
+455
View File
@@ -2127,6 +2127,44 @@
],
"type": "object"
},
"GenerationCreateHeaders": {
"additionalProperties": true,
"properties": {
"idempotency-key": {
"maxLength": 200,
"minLength": 32,
"pattern": "^[A-Za-z0-9_-]+$",
"type": "string"
},
"x-csrf-token": {
"maxLength": 64,
"minLength": 43,
"pattern": "^[A-Za-z0-9_-]+$",
"type": "string"
}
},
"required": [
"idempotency-key",
"x-csrf-token"
],
"type": "object"
},
"GenerationCreateResponse": {
"additionalProperties": false,
"properties": {
"created": {
"type": "boolean"
},
"task": {
"$ref": "#/components/schemas/GenerationTaskResponse"
}
},
"required": [
"created",
"task"
],
"type": "object"
},
"GenerationErrorCategory": {
"anyOf": [
{
@@ -2185,6 +2223,95 @@
}
]
},
"GenerationMultipartBody": {
"additionalProperties": false,
"properties": {
"client_submission_id": {
"pattern": "^[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}$",
"type": "string"
},
"confirmed_credit_cost": {
"pattern": "^[1-9][0-9]*$",
"type": "string"
},
"creation_mode": {
"anyOf": [
{
"enum": [
"new_project"
],
"type": "string"
},
{
"enum": [
"existing_project"
],
"type": "string"
}
]
},
"existing_reference_asset_ids": {
"maxLength": 12000,
"type": "string"
},
"model_config_version": {
"pattern": "^[1-9][0-9]*$",
"type": "string"
},
"model_id": {
"maxLength": 160,
"minLength": 1,
"type": "string"
},
"project_id": {
"pattern": "^[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}$",
"type": "string"
},
"prompt": {
"maxLength": 4000,
"minLength": 1,
"type": "string"
},
"ratio": {
"$ref": "#/components/schemas/ProjectRatio"
},
"reference_files": {
"items": {
"format": "binary",
"type": "string"
},
"maxItems": 16,
"type": "array"
},
"reference_manifest": {
"maxLength": 16384,
"type": "string"
}
},
"required": [
"client_submission_id",
"confirmed_credit_cost",
"creation_mode",
"model_config_version",
"model_id",
"prompt",
"ratio"
],
"type": "object"
},
"GenerationParams": {
"additionalProperties": false,
"properties": {
"generationId": {
"pattern": "^[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}$",
"type": "string"
}
},
"required": [
"generationId"
],
"type": "object"
},
"GenerationProjectItem": {
"additionalProperties": false,
"properties": {
@@ -2264,6 +2391,107 @@
],
"type": "object"
},
"GenerationTaskResponse": {
"additionalProperties": false,
"properties": {
"confirmed_credit_cost": {
"minimum": 1,
"type": "integer"
},
"created_at": {
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
},
"generation_id": {
"pattern": "^[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}$",
"type": "string"
},
"model_config_version": {
"minimum": 1,
"type": "integer"
},
"model_id": {
"maxLength": 160,
"minLength": 1,
"type": "string"
},
"project_id": {
"$ref": "#/components/schemas/ProjectId"
},
"prompt": {
"maxLength": 4000,
"minLength": 1,
"type": "string"
},
"ratio": {
"$ref": "#/components/schemas/ProjectRatio"
},
"reference_count": {
"minimum": 0,
"type": "integer"
},
"reserved_credits": {
"minimum": 0,
"type": "integer"
},
"status": {
"$ref": "#/components/schemas/GenerationTaskStatus"
},
"updated_at": {
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
}
},
"required": [
"confirmed_credit_cost",
"created_at",
"generation_id",
"model_config_version",
"model_id",
"project_id",
"prompt",
"ratio",
"reference_count",
"reserved_credits",
"status",
"updated_at"
],
"type": "object"
},
"GenerationTaskStatus": {
"anyOf": [
{
"enum": [
"queued"
],
"type": "string"
},
{
"enum": [
"running"
],
"type": "string"
},
{
"enum": [
"succeeded"
],
"type": "string"
},
{
"enum": [
"failed"
],
"type": "string"
},
{
"enum": [
"rejected"
],
"type": "string"
}
]
},
"LoginCompleteRequest": {
"additionalProperties": false,
"properties": {
@@ -5530,6 +5758,233 @@
]
}
},
"/api/v1/generations": {
"post": {
"operationId": "createGeneration",
"parameters": [
{
"in": "header",
"name": "idempotency-key",
"required": true,
"schema": {
"maxLength": 200,
"minLength": 32,
"pattern": "^[A-Za-z0-9_-]+$",
"type": "string"
}
},
{
"in": "header",
"name": "x-csrf-token",
"required": true,
"schema": {
"maxLength": 64,
"minLength": 43,
"pattern": "^[A-Za-z0-9_-]+$",
"type": "string"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/GenerationMultipartBody"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenerationCreateResponse"
}
}
},
"description": "Default Response"
},
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenerationCreateResponse"
}
}
},
"description": "Default Response"
},
"400": {
"description": "Default Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"409": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"412": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"507": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
}
},
"tags": [
"Generations"
]
}
},
"/api/v1/generations/{generationId}": {
"get": {
"operationId": "getGeneration",
"parameters": [
{
"in": "path",
"name": "generationId",
"required": true,
"schema": {
"pattern": "^[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}$",
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenerationTaskResponse"
}
}
},
"description": "Default Response"
},
"400": {
"description": "Default Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"404": {
"description": "Default Response"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
}
},
"tags": [
"Generations"
]
}
},
"/api/v1/generations/current": {
"get": {
"operationId": "getCurrentGeneration",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenerationTaskResponse"
}
}
},
"description": "Default Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"404": {
"description": "Default Response"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
}
},
"tags": [
"Generations"
]
}
},
"/api/v1/me/credit-ledger": {
"get": {
"operationId": "getMyCreditLedger",