Update read_image output with box drawing characters
- Print └─ before images to break out of tool output box - Print ┌─ after images to resume tool output box - Remove │ prefix from image preview and info lines - Info line uses single space prefix, dimmed text - Only include error messages in tool result (success info printed via imgcat)
This commit is contained in:
@@ -5034,6 +5034,9 @@ impl<W: UiWriter> Agent<W> {
|
|||||||
let mut results: Vec<String> = Vec::new();
|
let mut results: Vec<String> = Vec::new();
|
||||||
let mut success_count = 0;
|
let mut success_count = 0;
|
||||||
|
|
||||||
|
// Print └─ before images to break out of tool output box
|
||||||
|
println!("└─");
|
||||||
|
|
||||||
for path_str in &paths {
|
for path_str in &paths {
|
||||||
// Expand tilde (~) to home directory
|
// Expand tilde (~) to home directory
|
||||||
let expanded_path = shellexpand::tilde(path_str);
|
let expanded_path = shellexpand::tilde(path_str);
|
||||||
@@ -5105,13 +5108,21 @@ impl<W: UiWriter> Agent<W> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print ┌─ to resume tool output box
|
||||||
|
print!("┌─\n");
|
||||||
|
|
||||||
let summary = if success_count == paths.len() {
|
let summary = if success_count == paths.len() {
|
||||||
format!("\n{} image(s) read.", success_count)
|
format!("{} image(s) read.", success_count)
|
||||||
} else {
|
} else {
|
||||||
format!("\n{}/{} image(s) read.", success_count, paths.len())
|
format!("{}/{} image(s) read.", success_count, paths.len())
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(format!("{}\n{}", results.join("\n"), summary))
|
// Only include error results if there are any
|
||||||
|
if results.is_empty() {
|
||||||
|
Ok(summary)
|
||||||
|
} else {
|
||||||
|
Ok(format!("{}\n{}", results.join("\n"), summary))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"write_file" => {
|
"write_file" => {
|
||||||
debug!("Processing write_file tool call");
|
debug!("Processing write_file tool call");
|
||||||
@@ -6762,10 +6773,10 @@ impl<W: UiWriter> Agent<W> {
|
|||||||
let encoded = base64::engine::general_purpose::STANDARD.encode(bytes);
|
let encoded = base64::engine::general_purpose::STANDARD.encode(bytes);
|
||||||
// iTerm2 inline image protocol (single space prefix)
|
// iTerm2 inline image protocol (single space prefix)
|
||||||
print!(" \x1b]1337;File=inline=1;height={};name={}:{}\x07\n", max_height, name, encoded);
|
print!(" \x1b]1337;File=inline=1;height={};name={}:{}\x07\n", max_height, name, encoded);
|
||||||
// Print dimmed info line on its own line
|
// Print dimmed info line (no │ prefix)
|
||||||
println!("│ \x1b[2m{} | {} | {} | {}\x1b[0m", name, dimensions, media_type, size);
|
println!(" \x1b[2m{} | {} | {} | {}\x1b[0m", name, dimensions, media_type, size);
|
||||||
// Blank line before next image
|
// Blank line before next image (no │ prefix)
|
||||||
println!("│");
|
println!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_duration(duration: Duration) -> String {
|
fn format_duration(duration: Duration) -> String {
|
||||||
|
|||||||
Reference in New Issue
Block a user