接通抠图模式到BgFilter队列

透传backgroundMode和screenColor到内部worker

保留auto及省略颜色的下游识别语义
This commit is contained in:
2026-09-16 20:41:48 +08:00
committed by 孔令弘
parent a17367112f
commit ca761e093c
@@ -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<EditorBackgroundRemovalImage, AppError> {
// 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