Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions crates/chat-cli/src/cli/chat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2868,6 +2868,11 @@ impl ChatContext {
} else {
self.conversation_state.add_tool_results(tool_results);
}
if self.interactive {
execute!(self.output, cursor::Hide)?;
execute!(self.output, style::Print("\n"), style::SetAttribute(Attribute::Reset))?;
self.spinner = Some(Spinner::new(Spinners::Dots, "Thinking...".to_string()));
}

self.send_tool_use_telemetry().await;
return Ok(ChatState::HandleResponseStream(
Expand All @@ -2888,6 +2893,19 @@ impl ChatContext {
let mut tool_uses = Vec::new();
let mut tool_name_being_recvd: Option<String> = None;

if self.interactive && self.spinner.is_some() {
drop(self.spinner.take());
queue!(
self.output,
style::SetForegroundColor(Color::Reset),
terminal::Clear(terminal::ClearType::CurrentLine),
cursor::MoveToColumn(0),
cursor::Show,
cursor::MoveUp(1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the moveup(1) and clear required here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to make sure the two "thinking" are on the same line. I think somewhere in this function we printed a newline as a hack for something.

terminal::Clear(terminal::ClearType::CurrentLine),
)?;
}

loop {
match parser.recv().await {
Ok(msg_event) => {
Expand Down
Loading