Skip to content

Commit da59663

Browse files
fix: add request id to errored json message (#1332)
1 parent 76ce78d commit da59663

File tree

1 file changed

+9
-3
lines changed
  • crates/q_cli/src/cli/chat

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,11 +2584,17 @@ impl ChatContext {
25842584
style::SetForegroundColor(Color::Yellow),
25852585
style::SetAttribute(Attribute::Bold),
25862586
style::Print(format!(
2587-
"Warning: received an unexpected error from the model after {:.2}s\n\n",
2587+
"Warning: received an unexpected error from the model after {:.2}s",
25882588
time_elapsed.as_secs_f64()
25892589
)),
2590-
style::SetAttribute(Attribute::Reset),
25912590
)?;
2591+
if let Some(request_id) = recv_error.request_id {
2592+
queue!(
2593+
self.output,
2594+
style::Print(format!("\n request_id: {}", request_id))
2595+
)?;
2596+
}
2597+
execute!(self.output, style::Print("\n\n"), style::SetAttribute(Attribute::Reset))?;
25922598
self.spinner = Some(Spinner::new(
25932599
Spinners::Dots,
25942600
"Trying to divide up the work...".to_string(),
@@ -2857,7 +2863,7 @@ impl ChatContext {
28572863
.tool
28582864
.queue_description(&self.ctx, &mut self.output)
28592865
.await
2860-
.map_err(|e| ChatError::Custom(format!("failed to print tool: {}", e).into()))?;
2866+
.map_err(|e| ChatError::Custom(format!("failed to print tool, `{}`: {}", tool_use.name, e).into()))?;
28612867

28622868
Ok(())
28632869
}

0 commit comments

Comments
 (0)