From af9078cb97a2e8f2a63de5650cfb2753970df14a Mon Sep 17 00:00:00 2001 From: Linghong Date: Wed, 16 Sep 2026 21:36:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8A=A0=E5=9B=BE=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E8=B0=83=E7=94=A8=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 说明complex语义分割与flat纯色背景抠图 明确纯色背景优先使用flat并移除内部实现术语 --- .../src-tauri/src/agent/direct_tools_mcp.rs | 4 ++-- docs/openapi/genarrative-external-v1.openapi.json | 6 +++--- .../【技术方案】AGC抠图模式与背景色透传-2026-09-16.md | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/direct_tools_mcp.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/direct_tools_mcp.rs index 545ea261d..2563bf913 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/direct_tools_mcp.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/direct_tools_mcp.rs @@ -453,12 +453,12 @@ fn direct_tools_mcp_specs_for(controlled_web_search: bool, _cocos_editor_availab "backgroundMode": { "type": "string", "enum": ["complex", "flat"], - "description": "可选抠图模式;省略时使用 complex" + "description": "可选抠图模式:complex 用语义分割识别前景,flat 用纯色背景抠图;确定背景为纯色时优先使用 flat。省略时使用 complex" }, "screenColor": { "type": "string", "pattern": "^(auto|#[0-9A-Fa-f]{6})$", - "description": "flat 模式可选背景色;传 auto 或 #RRGGBB,省略由 BgFilter 自动检测" + "description": "flat 模式可选背景色;传 auto 或 #RRGGBB,省略时由服务自动检测" } }, "required": ["sourceLocalAssetId", "assetName"], diff --git a/docs/openapi/genarrative-external-v1.openapi.json b/docs/openapi/genarrative-external-v1.openapi.json index a55435e7e..7e24f3460 100644 --- a/docs/openapi/genarrative-external-v1.openapi.json +++ b/docs/openapi/genarrative-external-v1.openapi.json @@ -1122,7 +1122,7 @@ "tags": ["Editor Images"], "operationId": "removeExternalEditorImageBackground", "summary": "去除编辑器图片背景", - "description": "提交已有静态图片素材的异步去背景任务。sourceImageSrc 只接受当前账号拥有的稳定 objectKey、项目资源 ID 或素材 ID;禁止 Data URL、Blob URL 和临时 signed URL。assetKind 只能表达静态图片,并且存在权威来源记录时必须与其类型一致;视频、音频、动画和图片序列在入队前返回 400。服务端固定使用 complex 去背景模式,不会在失败时切换到其它 provider。需要写入画布时提供 projectId 与 canvasCompletion;仅需原位替换既有图层时提供 projectId 与 targetLayerId,且来源与目标必须指向同一权威对象。", + "description": "提交已有静态图片素材的异步去背景任务。sourceImageSrc 只接受当前账号拥有的稳定 objectKey、项目资源 ID 或素材 ID;禁止 Data URL、Blob URL 和临时 signed URL。assetKind 只能表达静态图片,并且存在权威来源记录时必须与其类型一致;视频、音频、动画和图片序列在入队前返回 400。complex 使用语义分割识别前景,flat 用于纯色背景抠图;确定背景为纯色时优先使用 flat。需要写入画布时提供 projectId 与 canvasCompletion;仅需原位替换既有图层时提供 projectId 与 targetLayerId,且来源与目标必须指向同一权威对象。", "security": [ { "ExternalApiKey": [] @@ -3215,12 +3215,12 @@ "type": ["string", "null"], "enum": ["complex", "flat", null], "default": "complex", - "description": "抠图模式。不填按 complex 处理;flat 使用纯色背景管线。" + "description": "抠图模式。不填按 complex 处理;complex 使用语义分割识别前景,flat 用于纯色背景抠图。确定背景为纯色时优先使用 flat。" }, "screenColor": { "type": ["string", "null"], "pattern": "^(auto|#[0-9A-Fa-f]{6})$", - "description": "仅 flat 模式使用。可传 auto、#RRGGBB 或省略;auto 和省略由 BgFilter 自动检测背景色。complex 搭配此字段返回 400。" + "description": "仅 flat 模式使用。可传 auto、#RRGGBB 或省略;auto 和省略由服务自动检测背景色。complex 搭配此字段返回 400。" }, "projectId": { "type": ["string", "null"], diff --git a/docs/technical/【技术方案】AGC抠图模式与背景色透传-2026-09-16.md b/docs/technical/【技术方案】AGC抠图模式与背景色透传-2026-09-16.md index 9ad7184ee..7cc154a24 100644 --- a/docs/technical/【技术方案】AGC抠图模式与背景色透传-2026-09-16.md +++ b/docs/technical/【技术方案】AGC抠图模式与背景色透传-2026-09-16.md @@ -2,7 +2,7 @@ ## 目标 -主站编辑器保持现有前端行为(继续使用 `complex`),同时扩展 External v1 抠图接口和 AGC 客户端,使客户端可以选择 `complex` / `flat`,并把 `screenColor` 原样交给 BgFilter。`auto` 的背景色识别完全由 BgFilter 负责,主站不读取图片、不调用模型决策颜色、不生成颜色兜底值。 +主站编辑器保持现有前端行为(继续使用 `complex`),同时扩展 External v1 抠图接口和 AGC 客户端,使客户端可以选择 `complex` / `flat`,并把 `screenColor` 原样交给 BgFilter。`complex` 用语义分割识别前景,`flat` 用于纯色背景抠图;确定背景为纯色时优先使用 `flat`。`auto` 的背景色识别完全由下游服务负责,主站不读取图片、不调用模型决策颜色、不生成颜色兜底值。 ## 当前 BgFilter 契约 @@ -16,7 +16,7 @@ 主站向 BgFilter 发送 `#RRGGBB` 时保留 `#`,`auto` 也原样发送,不做所谓的“hex 转换”。 -服务器实现细节:`screen_color` 在 `auto` 或省略时传入内部 pipeline 的 `None`,由边框颜色自动检测;`#RRGGBB` 才会经过颜色解析用于色键。`background_mode` 缺省在 BgFilter 侧为 `flat`,因此主站必须为 External v1 旧请求显式归一化为 `complex`,不能把 BgFilter 的默认值直接当成主站默认值。 +服务器行为:`screen_color` 在 `auto` 或省略时由服务自动检测;`#RRGGBB` 用作指定背景色。`background_mode` 缺省在 BgFilter 侧为 `flat`,因此主站必须为 External v1 旧请求显式归一化为 `complex`,不能把下游服务的默认值直接当成主站默认值。 ## External v1 请求契约