加固分离提示词生成
绑定提示改用切片参数避免多余复制 清理提取提示中的描述与返工备注文本
This commit is contained in:
+1
-1
@@ -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})");
|
||||
|
||||
+10
-3
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user