feat(server): add imageQuality/imageCount and output_format to API contract

Extend CreateProject/Generate/AgentChat request types with imageQuality
and imageCount, and add output_format to GeneratorTaskInputArgs for
layered (PSD) generation output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-09 20:42:11 +08:00
parent a1503a1687
commit db41dac5e9
3 changed files with 43 additions and 25 deletions
+5 -1
View File
@@ -167,6 +167,8 @@ Returns all project summaries, sorted by `updatedAt` descending.
"prompt": "为 still day 品牌服装独立站设计官网视觉方向",
"imageModel": "gpt-image-2",
"imageSize": "1024x1024",
"imageQuality": "auto",
"imageCount": 1,
"enableWebSearch": true
}
```
@@ -217,6 +219,8 @@ Deletes the project record. PostgreSQL cascades canvas nodes, chat messages, his
"enableWebSearch": false,
"imageModel": "gpt-image-2",
"imageSize": "1024x1024",
"imageQuality": "auto",
"imageCount": 1,
"mode": "design"
}
```
@@ -253,7 +257,7 @@ The generation path uses the configured design agent runner. The default is the
}
```
`layer-separation` returns a task id that can be polled with `GET /api/generator/tasks?task_id=<id>&project_id=<project-id>`. Completed tasks return a clean background image, foreground image artifacts with `bbox`, and a `text_render_data` artifact for editable text reconstruction.
`layer-separation` returns a task id that can be polled with `GET /api/generator/tasks?task_id=<id>&project_id=<project-id>`. When layered output is available, the service asks GPT Image 2 for a PSD, converts PSD layers into canvas image/text nodes, and falls back to the local separation path if PSD generation or decoding fails. Completed tasks return a clean background image, foreground image artifacts with `bbox`, and a `text_render_data` artifact for editable text reconstruction.
The canvas `edit-elements` node action uses the same separation path but writes the separated result beside the original image. The original image remains unchanged; the clean background is a bottom image layer, and a transparent frame above it holds the separated foreground images and editable text layers.
+19 -12
View File
@@ -330,6 +330,8 @@ type CreateProjectRequest {
Prompt string `json:"prompt,optional"`
ImageModel string `json:"imageModel,optional"`
ImageSize string `json:"imageSize,optional"`
ImageQuality string `json:"imageQuality,optional"`
ImageCount int64 `json:"imageCount,optional"`
EnableWebSearch bool `json:"enableWebSearch,optional"`
AllowEmptyPrompt bool `json:"allowEmptyPrompt,optional"`
}
@@ -508,11 +510,13 @@ type CandaThreadStatusResponse {
}
type GenerateRequest {
Id string `path:"id"`
Prompt string `json:"prompt"`
Mode string `json:"mode,optional"`
ImageModel string `json:"imageModel,optional"`
ImageSize string `json:"imageSize,optional"`
Id string `path:"id"`
Prompt string `json:"prompt"`
Mode string `json:"mode,optional"`
ImageModel string `json:"imageModel,optional"`
ImageSize string `json:"imageSize,optional"`
ImageQuality string `json:"imageQuality,optional"`
ImageCount int64 `json:"imageCount,optional"`
}
type AgentContent {
@@ -549,6 +553,8 @@ type AgentChatRequest {
EnableWebSearch bool `json:"enableWebSearch,optional"`
ImageModel string `json:"imageModel,optional"`
ImageSize string `json:"imageSize,optional"`
ImageQuality string `json:"imageQuality,optional"`
ImageCount int64 `json:"imageCount,optional"`
Mode string `json:"mode,optional"`
}
@@ -613,13 +619,14 @@ type GeneratorTaskRequest {
}
type GeneratorTaskInputArgs {
AspectRatio string `json:"aspect_ratio,optional"`
Image []string `json:"image,optional"`
ImageUrl string `json:"image_url,optional"`
Prompt string `json:"prompt,optional"`
Resolution string `json:"resolution,optional"`
SrcBox *NormalizedBox `json:"src_box,omitempty,optional"`
DstBox *NormalizedBox `json:"dst_box,omitempty,optional"`
AspectRatio string `json:"aspect_ratio,optional"`
Image []string `json:"image,optional"`
ImageUrl string `json:"image_url,optional"`
OutputFormat string `json:"output_format,optional"`
Prompt string `json:"prompt,optional"`
Resolution string `json:"resolution,optional"`
SrcBox *NormalizedBox `json:"src_box,omitempty,optional"`
DstBox *NormalizedBox `json:"dst_box,omitempty,optional"`
}
type GeneratorTaskSubmitRequest {
+19 -12
View File
@@ -41,6 +41,8 @@ type AgentChatRequest struct {
EnableWebSearch bool `json:"enableWebSearch,optional"`
ImageModel string `json:"imageModel,optional"`
ImageSize string `json:"imageSize,optional"`
ImageQuality string `json:"imageQuality,optional"`
ImageCount int64 `json:"imageCount,optional"`
Mode string `json:"mode,optional"`
}
@@ -321,6 +323,8 @@ type CreateProjectRequest struct {
Prompt string `json:"prompt,optional"`
ImageModel string `json:"imageModel,optional"`
ImageSize string `json:"imageSize,optional"`
ImageQuality string `json:"imageQuality,optional"`
ImageCount int64 `json:"imageCount,optional"`
EnableWebSearch bool `json:"enableWebSearch,optional"`
AllowEmptyPrompt bool `json:"allowEmptyPrompt,optional"`
}
@@ -397,11 +401,13 @@ type GenerateMockupModelRequest struct {
}
type GenerateRequest struct {
Id string `path:"id"`
Prompt string `json:"prompt"`
Mode string `json:"mode,optional"`
ImageModel string `json:"imageModel,optional"`
ImageSize string `json:"imageSize,optional"`
Id string `path:"id"`
Prompt string `json:"prompt"`
Mode string `json:"mode,optional"`
ImageModel string `json:"imageModel,optional"`
ImageSize string `json:"imageSize,optional"`
ImageQuality string `json:"imageQuality,optional"`
ImageCount int64 `json:"imageCount,optional"`
}
type GenerateResponse struct {
@@ -446,13 +452,14 @@ type GeneratorTaskDisableUnlimitedPrice struct {
}
type GeneratorTaskInputArgs struct {
AspectRatio string `json:"aspect_ratio,optional"`
Image []string `json:"image,optional"`
ImageUrl string `json:"image_url,optional"`
Prompt string `json:"prompt,optional"`
Resolution string `json:"resolution,optional"`
SrcBox *NormalizedBox `json:"src_box,omitempty,optional"`
DstBox *NormalizedBox `json:"dst_box,omitempty,optional"`
AspectRatio string `json:"aspect_ratio,optional"`
Image []string `json:"image,optional"`
ImageUrl string `json:"image_url,optional"`
OutputFormat string `json:"output_format,optional"`
Prompt string `json:"prompt,optional"`
Resolution string `json:"resolution,optional"`
SrcBox *NormalizedBox `json:"src_box,omitempty,optional"`
DstBox *NormalizedBox `json:"dst_box,omitempty,optional"`
}
type GeneratorTaskPriceDetail struct {