From ca761e093ca1e0408e228219d7eb3d009c8292b6 Mon Sep 17 00:00:00 2001 From: Linghong Date: Wed, 16 Sep 2026 20:41:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E9=80=9A=E6=8A=A0=E5=9B=BE=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=88=B0BgFilter=E9=98=9F=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 透传backgroundMode和screenColor到内部worker 保留auto及省略颜色的下游识别语义 --- server-rs/crates/api-server/src/editor_project.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/server-rs/crates/api-server/src/editor_project.rs b/server-rs/crates/api-server/src/editor_project.rs index aebeb5965..e1ca4cf81 100644 --- a/server-rs/crates/api-server/src/editor_project.rs +++ b/server-rs/crates/api-server/src/editor_project.rs @@ -6781,6 +6781,8 @@ pub(crate) async fn remove_editor_image_background_for_owner( let removed = request_editor_background_removal_image_with_bgfilter_worker( state, source.object_key.as_str(), + payload.background_mode.as_deref().unwrap_or("complex"), + payload.screen_color.as_deref(), &matting_audit, ) .await?; @@ -8004,15 +8006,21 @@ fn editor_bgfilter_flat_deadline_reserve(aliyun_timeout_ms: u64) -> Duration { async fn request_editor_background_removal_image_with_bgfilter_worker( state: &AppState, source_object_key: &str, + background_mode: &str, + screen_color: Option<&str>, audit: &crate::external_api_audit::ExternalApiAuditContext, ) -> Result { // complex 没有 flat fallback,排队上限只预留 2s 传输窗;worker 重启窗口内的 // 连接失败由 client 内部按预算有界重试,避免 max_attempts=1 的队列任务终态失败。 + let mode = match background_mode { + "flat" => crate::bgfilter_worker::BgfilterBackgroundMode::Flat, + _ => crate::bgfilter_worker::BgfilterBackgroundMode::Complex, + }; let removed = crate::bgfilter_worker::request_bgfilter_worker_with_connect_retry( state, source_object_key, - crate::bgfilter_worker::BgfilterBackgroundMode::Complex, - None, + mode, + screen_color, EDITOR_BGFILTER_DEFAULT_SEG_MODEL, EDITOR_BGFILTER_CROSS_CHECK_DISABLED, EDITOR_BGFILTER_PARENT_TRANSPORT_WINDOW, @@ -22111,6 +22119,8 @@ mod tests { let removed = request_editor_background_removal_image_with_bgfilter_worker( &state, "generated-character-drafts/editor/manual-source.png", + "complex", + None, &audit, ) .await