Skip to content

Commit 52b5455

Browse files
authored
fix: images related issues (#1753)
* fix: reset terminal attributes after adding tool results * fix: don't throw when slash file path is at the beginning of the user input
1 parent dd39398 commit 52b5455

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

crates/chat-cli/src/cli/chat/command.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -810,13 +810,8 @@ impl Command {
810810
}
811811
},
812812
"usage" => Self::Usage,
813-
unknown_command => {
814-
// If the command starts with a slash but isn't recognized,
815-
// return an error instead of treating it as a prompt
816-
return Err(format!(
817-
"Unknown command: '/{}'. Type '/help' to see available commands.\nTo use a literal slash at the beginning of your message, escape it with a backslash (e.g., '\\//hey' for '/hey').",
818-
unknown_command
819-
));
813+
_unknown_command => Self::Ask {
814+
prompt: input.to_string(),
820815
},
821816
});
822817
}

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2865,6 +2865,12 @@ impl ChatContext {
28652865
let images = image_blocks.into_iter().map(|(block, _)| block).collect();
28662866
self.conversation_state
28672867
.add_tool_results_with_images(tool_results, images);
2868+
execute!(
2869+
self.output,
2870+
style::SetAttribute(Attribute::Reset),
2871+
style::SetForegroundColor(Color::Reset),
2872+
style::Print("\n")
2873+
)?;
28682874
} else {
28692875
self.conversation_state.add_tool_results(tool_results);
28702876
}

0 commit comments

Comments
 (0)