From cf68b8212d15d5c00e0ca128bf76228a207f069a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 11 Sep 2026 18:52:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A9=E6=8F=90=E5=8F=96=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=8D=E5=BA=8F=E5=88=97=E5=8C=96=E9=94=99=E8=AF=AF=E5=8F=AF?= =?UTF-8?q?=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将提取提示词生成改为返回带上下文的错误。 --- .../src/ui_editor/commands/separation/prompt/extract.rs | 6 +++--- .../src/ui_editor/commands/separation/workflow/mod.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/prompt/extract.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/prompt/extract.rs index e0059e2b9..9b6e7a2ed 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/prompt/extract.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/prompt/extract.rs @@ -45,7 +45,7 @@ pub(crate) fn gen_extract_prompt( state: &SeparationState, tree: &SeparationTree, batch: &[&SeparationNode], -) -> String { +) -> Result { let mut result = r#" This is a UI design image, not a normal photo/illustration. Extract it strictly as UI elements/layers, not as a generic foreground/background extraction. Treat distinct UI element as its own layer with hard, clean, pixel-accurate edges and full transparency outside the element. @@ -78,12 +78,12 @@ pub(crate) fn gen_extract_prompt( ui_layer_tree: project_node(&tree.root, &target_ids, &terminal_ids, &mut index), }; let yaml = serde_yaml::to_string(&document) - .expect("UI separation extract prompt projection must be serializable"); + .map_err(|error| format!("UI separation extract prompt projection failed: {error}"))?; result.push_str("```yaml\n"); result.push_str(&yaml); result.push_str("```\n"); - result + Ok(result) } fn project_node( diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/mod.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/mod.rs index 8c492b9b6..b145d8e9b 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/mod.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/mod.rs @@ -127,7 +127,7 @@ pub(crate) async fn separate_ui_impl( break; } let batch = batch_nodes.iter().collect::>(); - let prompt = gen_extract_prompt(&separation, current_tree, &batch); + let prompt = gen_extract_prompt(&separation, current_tree, &batch)?; app_log!( "ui_separation.batch_start tree_index={} batch_index={} nodes={} area_px={} image_edit_dimension_px={} prompt_chars={} rework_total={}", tree_index, batch_index, batch.len(), batch_area_px, image_edit_dimension_px,