From 4d9e69841e0dfee01ade369336c6b60652d5caed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 12 Sep 2026 02:04:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=9B=BA=E5=88=86=E7=A6=BB=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E8=AF=8D=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 绑定提示改用切片参数避免多余复制 清理提取提示中的描述与返工备注文本 --- .../ui_editor/commands/separation/prompt/binding.rs | 2 +- .../ui_editor/commands/separation/prompt/extract.rs | 13 ++++++++++--- .../commands/separation/workflow/binding.rs | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/prompt/binding.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/prompt/binding.rs index 2b77bf71c..575ebb913 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/prompt/binding.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/prompt/binding.rs @@ -1,7 +1,7 @@ use crate::ui_editor::commands::separation::image_preprocess::VISUAL_BINDING_TRANSPARENT_MARKER_RGBA; use crate::ui_editor::commands::separation::SeparationNode; -pub(crate) fn gen_binding_prompt(nodes: Vec<&SeparationNode>) -> String { +pub(crate) fn gen_binding_prompt(nodes: &[&SeparationNode]) -> String { let [marker_red, marker_green, marker_blue, marker_alpha] = VISUAL_BINDING_TRANSPARENT_MARKER_RGBA; let marker_color = format!("rgba({marker_red}, {marker_green}, {marker_blue}, {marker_alpha})"); 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 9b6e7a2ed..d6edfe0e5 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 @@ -1,4 +1,6 @@ -use crate::ui_editor::commands::separation::model::{SeparationState, SeparationTree}; +use crate::ui_editor::commands::separation::model::{ + sanitize_prompt_text, SeparationState, SeparationTree, +}; use crate::ui_editor::commands::separation::{SeparationNode, SeparationNodeKind}; use crate::ui_editor::utils::NodeId; use serde::Serialize; @@ -122,8 +124,13 @@ fn project_node( width: node.width_px, height: node.height_px, }, - description: node.note.description.clone(), - rework_notes: node.note.rework_notes.clone(), + description: sanitize_prompt_text(&node.note.description), + rework_notes: node + .note + .rework_notes + .iter() + .map(|note| sanitize_prompt_text(note)) + .collect(), children, } } diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/binding.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/binding.rs index 7b13beaaf..255a204c7 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/binding.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow/binding.rs @@ -93,7 +93,7 @@ async fn visual_binding_inner( ) .with_strict(true); let initial_history = vec![ - LlmMessage::system(gen_binding_prompt(nodes.to_vec())), + LlmMessage::system(gen_binding_prompt(nodes)), LlmMessage::user_multimodal(vec![ LlmMessageContentPart::InputText { text: "processed image:".to_string(),