统一分离终止节点判定

批次选择与提取提示复用同一终止节点集合
This commit is contained in:
2026-09-12 02:23:02 +08:00
parent eada20c199
commit bec468bdc9
2 changed files with 4 additions and 13 deletions
@@ -1,6 +1,7 @@
use crate::ui_editor::commands::separation::model::{
sanitize_prompt_text, SeparationState, SeparationTree,
};
use crate::ui_editor::commands::separation::workflow::batch::terminal_node_ids;
use crate::ui_editor::commands::separation::{SeparationNode, SeparationNodeKind};
use crate::ui_editor::utils::NodeId;
use serde::Serialize;
@@ -64,17 +65,7 @@ pub(crate) fn gen_extract_prompt(
.iter()
.map(|node| node.id.clone())
.collect::<HashSet<_>>();
let terminal_ids = state
.bound
.iter()
.map(|node| node.node_id.clone())
.chain(
state
.problematic_nodes
.iter()
.map(|node| node.node_id.clone()),
)
.collect::<HashSet<_>>();
let terminal_ids = terminal_node_ids(state);
let mut index = 1;
let document = ExtractPromptDocument {
ui_layer_tree: project_node(&tree.root, &target_ids, &terminal_ids, &mut index),
@@ -40,7 +40,7 @@ pub fn image_edit_dimension_for_area(area_px: u64) -> u32 {
aligned.clamp(IMAGE_EDIT_MIN_DIMENSION_PX, IMAGE_EDIT_MAX_DIMENSION_PX) as u32
}
fn terminal_ids(state: &SeparationState) -> HashSet<NodeId> {
pub(crate) fn terminal_node_ids(state: &SeparationState) -> HashSet<NodeId> {
state
.bound
.iter()
@@ -82,7 +82,7 @@ pub fn next_image_batch_with_size<'a>(
state: &SeparationState,
tree: &'a SeparationTree,
) -> ImageBatch<'a> {
let terminal = terminal_ids(state);
let terminal = terminal_node_ids(state);
let mut selected = Vec::new();
let mut area = 0;
collect_dfs_batch(