From 5aecadf70056af9707eddf84493b1cc8f008f8c7 Mon Sep 17 00:00:00 2001 From: Linghong Date: Wed, 16 Sep 2026 20:02:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A9=E5=B1=95=E4=B8=BB=E7=AB=99=E6=8A=A0?= =?UTF-8?q?=E5=9B=BE=E8=AF=B7=E6=B1=82=E5=A5=91=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加backgroundMode和screenColor可选字段 同步External v1 OpenAPI抠图模式说明 --- docs/openapi/genarrative-external-v1.openapi.json | 11 +++++++++++ server-rs/crates/api-server/src/editor_project.rs | 2 ++ .../crates/api-server/src/external_editor_api.rs | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/docs/openapi/genarrative-external-v1.openapi.json b/docs/openapi/genarrative-external-v1.openapi.json index 0a28b1ab6..a55435e7e 100644 --- a/docs/openapi/genarrative-external-v1.openapi.json +++ b/docs/openapi/genarrative-external-v1.openapi.json @@ -3211,6 +3211,17 @@ "minLength": 1, "description": "当前账号拥有的稳定 objectKey、项目资源 ID 或素材 ID。禁止 Data URL、Blob URL 和临时 signed URL。" }, + "backgroundMode": { + "type": ["string", "null"], + "enum": ["complex", "flat", null], + "default": "complex", + "description": "抠图模式。不填按 complex 处理;flat 使用纯色背景管线。" + }, + "screenColor": { + "type": ["string", "null"], + "pattern": "^(auto|#[0-9A-Fa-f]{6})$", + "description": "仅 flat 模式使用。可传 auto、#RRGGBB 或省略;auto 和省略由 BgFilter 自动检测背景色。complex 搭配此字段返回 400。" + }, "projectId": { "type": ["string", "null"], "description": "可选项目上下文。提供 targetLayerId 时必须同时提供非空 projectId,否则在入队前返回 400。" diff --git a/server-rs/crates/api-server/src/editor_project.rs b/server-rs/crates/api-server/src/editor_project.rs index 2c3ccb68e..481188301 100644 --- a/server-rs/crates/api-server/src/editor_project.rs +++ b/server-rs/crates/api-server/src/editor_project.rs @@ -452,6 +452,8 @@ pub struct EditorImageEditRequest { #[serde(rename_all = "camelCase")] pub struct EditorBackgroundRemovalRequest { pub(crate) source_image_src: String, + pub(crate) background_mode: Option, + pub(crate) screen_color: Option, pub(crate) project_id: Option, pub(crate) target_layer_id: Option, pub(crate) asset_kind: Option, diff --git a/server-rs/crates/api-server/src/external_editor_api.rs b/server-rs/crates/api-server/src/external_editor_api.rs index eeddb4371..b730cd5c2 100644 --- a/server-rs/crates/api-server/src/external_editor_api.rs +++ b/server-rs/crates/api-server/src/external_editor_api.rs @@ -169,6 +169,8 @@ pub struct ExternalEditorProjectResourceCreateRequest { #[serde(rename_all = "camelCase", deny_unknown_fields)] pub(crate) struct ExternalEditorBackgroundRemovalRequest { source_image_src: String, + background_mode: Option, + screen_color: Option, project_id: Option, target_layer_id: Option, asset_kind: Option, @@ -183,6 +185,8 @@ impl From for EditorBackgroundRemovalReq fn from(payload: ExternalEditorBackgroundRemovalRequest) -> Self { Self { source_image_src: payload.source_image_src, + background_mode: payload.background_mode, + screen_color: payload.screen_color, project_id: payload.project_id, target_layer_id: payload.target_layer_id, asset_kind: payload.asset_kind,