Skip to content
Open
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: 8 additions & 10 deletions src/commands/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ async fn run_single_shot(
// Show a thinking spinner while waiting for the first event
if is_tty {
let msg = THINKING_MESSAGES[rand::thread_rng().gen_range(0..THINKING_MESSAGES.len())];
println!();
spinner = Some(create_spinner(msg.dimmed().to_string()));
}

Expand Down Expand Up @@ -234,7 +233,6 @@ async fn run_repl(
if is_tty {
let msg =
THINKING_MESSAGES[rand::thread_rng().gen_range(0..THINKING_MESSAGES.len())];
println!();
spinner = Some(create_spinner(msg.dimmed().to_string()));
}

Expand Down Expand Up @@ -264,11 +262,11 @@ fn handle_event_human(
) {
match event {
ChatEvent::Chunk { text } => {
if let Some(s) = spinner.take() {
s.finish_and_clear();
}
let cleared_spinner = spinner.take().map(|s| s.finish_and_clear()).is_some();
if !*has_printed_text {
println!();
if !cleared_spinner {
println!();
}
print!("{} ", "Railway Agent:".purple().bold());
*has_printed_text = true;
}
Expand All @@ -277,11 +275,11 @@ fn handle_event_human(
}
ChatEvent::ToolCallReady { tool_name, .. } => {
if is_tty {
if let Some(s) = spinner.take() {
s.finish_and_clear();
}
let cleared_spinner = spinner.take().map(|s| s.finish_and_clear()).is_some();
*has_printed_text = false;
println!();
if !cleared_spinner {
println!();
}
*spinner = Some(create_spinner(format!(
"{} {}",
"╰─".dimmed(),
Expand Down
Loading