Skip to content

Commit 1bf7e95

Browse files
committed
fix: remove 30 second check when receiving invalid json from the model
1 parent c907784 commit 1bf7e95

File tree

2 files changed

+2
-29
lines changed

2 files changed

+2
-29
lines changed

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

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3337,38 +3337,12 @@ impl ChatContext {
33373337
tool_use_id,
33383338
name,
33393339
message,
3340-
time_elapsed,
3340+
..
33413341
} => {
33423342
error!(
33433343
recv_error.request_id,
33443344
tool_use_id, name, "The response stream ended before the entire tool use was received"
33453345
);
3346-
if self.interactive {
3347-
drop(self.spinner.take());
3348-
queue!(
3349-
self.output,
3350-
terminal::Clear(terminal::ClearType::CurrentLine),
3351-
cursor::MoveToColumn(0),
3352-
style::SetForegroundColor(Color::Yellow),
3353-
style::SetAttribute(Attribute::Bold),
3354-
style::Print(format!(
3355-
"Warning: received an unexpected error from the model after {:.2}s",
3356-
time_elapsed.as_secs_f64()
3357-
)),
3358-
)?;
3359-
if let Some(request_id) = recv_error.request_id {
3360-
queue!(
3361-
self.output,
3362-
style::Print(format!("\n request_id: {}", request_id))
3363-
)?;
3364-
}
3365-
execute!(self.output, style::Print("\n\n"), style::SetAttribute(Attribute::Reset))?;
3366-
self.spinner = Some(Spinner::new(
3367-
Spinners::Dots,
3368-
"Trying to divide up the work...".to_string(),
3369-
));
3370-
}
3371-
33723346
self.conversation_state.push_assistant_message(*message, database);
33733347
let tool_results = vec![ToolUseResult {
33743348
tool_use_id,

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ impl ResponseParser {
202202
// If we failed deserializing after waiting for a long time, then this is most
203203
// likely bedrock responding with a stop event for some reason without actually
204204
// including the tool contents. Essentially, the tool was too large.
205-
// Timeouts have been seen as short as ~1 minute, so setting the time to 30.
206205
let time_elapsed = start.elapsed();
207206
let args = serde_json::Value::Object(
208207
[(
@@ -214,7 +213,7 @@ impl ResponseParser {
214213
.into_iter()
215214
.collect(),
216215
);
217-
if self.peek().await?.is_none() && time_elapsed > Duration::from_secs(30) {
216+
if self.peek().await?.is_none() {
218217
error!(
219218
"Received an unexpected end of stream after spending ~{}s receiving tool events",
220219
time_elapsed.as_secs_f64()

0 commit comments

Comments
 (0)