From fa64819b6e60ab56a6611d8043f1cb37ec70e586 Mon Sep 17 00:00:00 2001 From: Linghong Date: Wed, 16 Sep 2026 19:59:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=BB=E7=BB=93BgFilter=E6=8A=A0=E5=9B=BE?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=A5=91=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 记录flat与complex模式及auto背景色行为 补充服务器认证头和当前运行版本 --- .../【技术方案】AGC抠图模式与背景色透传-2026-09-16.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/technical/【技术方案】AGC抠图模式与背景色透传-2026-09-16.md b/docs/technical/【技术方案】AGC抠图模式与背景色透传-2026-09-16.md index 754e8b005..9ad7184ee 100644 --- a/docs/technical/【技术方案】AGC抠图模式与背景色透传-2026-09-16.md +++ b/docs/technical/【技术方案】AGC抠图模式与背景色透传-2026-09-16.md @@ -6,15 +6,18 @@ ## 当前 BgFilter 契约 -生产服务器 `/root/BGfilter` 的服务契约为 `POST /remove-background` multipart: +已登录生产服务器核对 `/root/BGfilter`,当前代码版本为 `f1a0833`,运行进程为 `python -m uvicorn app:app --host 0.0.0.0 --port 6006 --workers 1 --no-access-log`。服务契约为 `POST /remove-background` multipart: - `background_mode`:可选,`flat` 或 `complex`; - `screen_color`:可选,支持 `#RRGGBB`、`auto` 或省略;省略/`auto` 时由 BgFilter 从图片边框自动检测; - `complex` 模式忽略 `screen_color`; - 自动检测失败由 BgFilter 返回 400。 +- 若配置 `BGFILTER_AUTH_TOKEN`,必须发送 `X-Genarrative-Image-Token`;缺失或错误返回 401;未配置时该接口不在服务层做 token 校验。 主站向 BgFilter 发送 `#RRGGBB` 时保留 `#`,`auto` 也原样发送,不做所谓的“hex 转换”。 +服务器实现细节:`screen_color` 在 `auto` 或省略时传入内部 pipeline 的 `None`,由边框颜色自动检测;`#RRGGBB` 才会经过颜色解析用于色键。`background_mode` 缺省在 BgFilter 侧为 `flat`,因此主站必须为 External v1 旧请求显式归一化为 `complex`,不能把 BgFilter 的默认值直接当成主站默认值。 + ## External v1 请求契约 接口保持: