隔离非法分离区域导致的批次失败
将裁切错误记录为 problematic 并继续流程 避免单个模型区域终止整页分离
This commit is contained in:
@@ -380,6 +380,7 @@ pub(crate) async fn separate_ui_impl(
|
||||
}
|
||||
};
|
||||
let mut cut_paths = std::collections::HashMap::new();
|
||||
let mut cut_error = None;
|
||||
for decision in &binding.decisions {
|
||||
if let BindingDecision::Ok {
|
||||
to_node,
|
||||
@@ -387,10 +388,24 @@ pub(crate) async fn separate_ui_impl(
|
||||
} = decision
|
||||
{
|
||||
let cut_path = sidecar.join(format!("cut-{}.png", to_node.as_str()));
|
||||
cut_processed_image(&processed_path, separated_image_area, &cut_path)?;
|
||||
cut_paths.insert(to_node.clone(), cut_path.to_string_lossy().to_string());
|
||||
match cut_processed_image(&processed_path, separated_image_area, &cut_path) {
|
||||
Ok(()) => {
|
||||
cut_paths
|
||||
.insert(to_node.clone(), cut_path.to_string_lossy().to_string());
|
||||
}
|
||||
Err(error) => {
|
||||
cut_error =
|
||||
Some(format!("节点 {} 的分离区域无效:{error}", to_node.as_str()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(error) = cut_error {
|
||||
mark_batch_problematic(&mut separation, tree_index, &batch, error);
|
||||
write_separation_state(&state_path, &separation)?;
|
||||
continue;
|
||||
}
|
||||
apply_batch_patch(&mut separation, tree_index, &binding.decisions, &cut_paths)?;
|
||||
write_separation_state(&state_path, &separation)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user