From feb6bc0ad4c0d909d9460a5f6a829f1b46346d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Wed, 9 Sep 2026 15:07:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=88=86=E7=A6=BB=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E6=81=A2=E5=A4=8D=E8=BE=B9=E7=95=8C=20=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=BC=96=E8=BE=91=E3=80=81=E5=86=99=E5=85=A5=E5=92=8C?= =?UTF-8?q?=E8=A3=81=E5=88=87=E5=A4=B1=E8=B4=A5=E4=BF=9D=E7=95=99=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=B9=B6=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF=20?= =?UTF-8?q?=E4=BB=85=E8=A7=86=E8=A7=89=E6=A8=A1=E5=9E=8B=E8=BF=94=E5=B7=A5?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E8=BF=9B=E5=85=A5=20problematic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui_editor/commands/separation/workflow.rs | 61 +++++-------------- 1 file changed, 14 insertions(+), 47 deletions(-) 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 521754270..e6ff0cbfc 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 @@ -89,27 +89,6 @@ pub fn apply_batch_patch( Ok(()) } -fn mark_batch_problematic( - state: &mut SeparationState, - tree_index: usize, - batch: &[&SeparationNode], - error: String, -) { - app_log!( - "ui_separation.batch_problematic tree_index={} nodes={} error={}", - tree_index, - batch.len(), - error - ); - for node in batch { - state.problematic_nodes.push(ProblematicNode { - node_id: node.id.clone(), - problem_description: error.clone(), - rework_count: node.rework_count, - }); - } -} - fn increment_rework_count(node: &mut SeparationNode, id: &NodeId, count: u32) { if node.id == *id { node.rework_count = count; @@ -299,17 +278,15 @@ async fn visual_binding( let client = client.clone(); let llm_config = llm_config.clone(); async move { - let request = LlmRunRequest::new(vec![ - LlmMessage::user_multimodal(vec![ - LlmMessageContentPart::InputText { text: prompt }, - LlmMessageContentPart::InputImage { - image_url: source_url, - }, - LlmMessageContentPart::InputImage { - image_url: processed_url, - }, - ]), - ]) + let request = LlmRunRequest::new(vec![LlmMessage::user_multimodal(vec![ + LlmMessageContentPart::InputText { text: prompt }, + LlmMessageContentPart::InputImage { + image_url: source_url, + }, + LlmMessageContentPart::InputImage { + image_url: processed_url, + }, + ])]) .with_function_tools(vec![tool.clone()]) .with_tool_choice(LlmToolChoice::Required); request_ui_editor_llm(&client, &llm_config, request) @@ -476,10 +453,8 @@ pub(crate) async fn separate_ui_impl( tree_index, batch_index ); - mark_batch_problematic(&mut separation, tree_index, &batch, error); write_separation_state(&state_path, &separation)?; - batch_index += 1; - continue; + return Err(error); } }; let processed_url = match raw_image_edit( @@ -498,10 +473,8 @@ pub(crate) async fn separate_ui_impl( tree_index, batch_index ); - mark_batch_problematic(&mut separation, tree_index, &batch, error); write_separation_state(&state_path, &separation)?; - batch_index += 1; - continue; + return Err(error); } }; let processed_path = sidecar.join(format!("processed-{}.png", separation.bound.len())); @@ -513,10 +486,8 @@ pub(crate) async fn separate_ui_impl( tree_index, batch_index ); - mark_batch_problematic(&mut separation, tree_index, &batch, error); write_separation_state(&state_path, &separation)?; - batch_index += 1; - continue; + return Err(error); } let binding = match visual_binding(source_url.clone(), processed_url, &batch).await { Ok(value) => value, @@ -526,10 +497,8 @@ pub(crate) async fn separate_ui_impl( tree_index, batch_index ); - mark_batch_problematic(&mut separation, tree_index, &batch, error); write_separation_state(&state_path, &separation)?; - batch_index += 1; - continue; + return Err(error); } }; app_log!( @@ -578,10 +547,8 @@ pub(crate) async fn separate_ui_impl( tree_index, batch_index ); - mark_batch_problematic(&mut separation, tree_index, &batch, error); write_separation_state(&state_path, &separation)?; - batch_index += 1; - continue; + return Err(error); } apply_batch_patch(&mut separation, tree_index, &binding.decisions, &cut_paths)?; write_separation_state(&state_path, &separation)?;