diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/mod.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/mod.rs index c2bcc3ce7..3050f6a47 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/mod.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/mod.rs @@ -6,7 +6,6 @@ mod prompt; mod tree; mod workflow; -pub(crate) use area::{normalize_binding_area, NormalizedBindingArea}; pub(crate) use marker::build_marked_image; pub use model::*; pub use persistence::*; @@ -31,7 +30,7 @@ mod tests { use std::path::Path; use typed_floats::tf32::StrictlyPositiveFinite; - fn node(id: &str, components: Vec, children: Vec) -> Node { + fn node(id: &str, component: Option, children: Vec) -> Node { Node { id: NodeId::new(id).unwrap(), layout: ControlLayout::default(), @@ -39,12 +38,12 @@ mod tests { name: id.to_string(), description: String::new(), layout_status: StageStatus::NoProblem, - components_status: StageStatus::NoProblem, + component_status: StageStatus::NoProblem, allow_llm_edit_layout: true, allow_llm_edit_component: true, source: NodeSource::Llm, }, - components, + component, children_display_mode: ChildrenDisplayMode::Stack, children, } @@ -84,11 +83,11 @@ mod tests { }); let root = node( "root", - vec![], + None, vec![node( "container", - vec![], - vec![node("image", vec![image], vec![])], + None, + vec![node("image", Some(image), vec![])], )], ); let result = construct_separation_state(&state(root)); @@ -103,7 +102,7 @@ mod tests { preserve_aspect: false, }, }); - let root = node("root-image", vec![image], vec![]); + let root = node("root-image", Some(image), vec![]); let result = construct_separation_state(&state(root)); let tree = &result.trees[0]; assert_eq!(tree.root.id.as_str(), "root-image"); @@ -121,11 +120,11 @@ mod tests { let text = Component::Text(TextComponent::new("按钮")); let root = node( "root", - vec![], + None, vec![node( "outer-image", - vec![image.clone()], - vec![node("text", vec![text.clone()], vec![])], + Some(image.clone()), + vec![node("text", Some(text.clone()), vec![])], )], ); let result = construct_separation_state(&state(root)); @@ -136,14 +135,14 @@ mod tests { let nested_root = node( "root", - vec![], + None, vec![node( "outer-image", - vec![image.clone()], + Some(image.clone()), vec![node( "inner-image", - vec![image], - vec![node("text", vec![text], vec![])], + Some(image), + vec![node("text", Some(text), vec![])], )], )], ); @@ -157,15 +156,15 @@ mod tests { fn root_image_receives_text_mask() { let root = node( "root-image", - vec![Component::Image(ImageComponent { + Some(Component::Image(ImageComponent { target_graphic: None, image_type: ImageType::Simple { preserve_aspect: false, }, - })], + })), vec![node( "text", - vec![Component::Text(TextComponent::new("标题"))], + Some(Component::Text(TextComponent::new("标题"))), vec![], )], ); @@ -219,8 +218,8 @@ mod tests { }); let mut separation = construct_separation_state(&state(node( "root", - vec![], - vec![node("image", vec![image], vec![])], + None, + vec![node("image", Some(image), vec![])], ))); let id = NodeId::new("image").unwrap(); let paths = HashMap::new(); @@ -303,8 +302,8 @@ mod tests { }); let mut state = construct_separation_state(&state(node( "root", - vec![], - vec![node("image", vec![image], vec![])], + None, + vec![node("image", Some(image), vec![])], ))); let id = NodeId::new("image").unwrap(); let decisions = vec![BindingDecision::Ok { diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow.rs index 16f6117e4..8d45c6a09 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow.rs @@ -1,3 +1,4 @@ +use super::area::normalize_binding_area; use super::model::*; use super::prompt::{gen_binding_prompt, gen_extract_prompt}; use crate::config::{build_game_creator_llm_client_from_llm_config, load_game_creator_app_config};