Fix databricks streaming errors (#4506)
This commit is contained in:
@@ -1276,12 +1276,26 @@ impl Session {
|
||||
if let Err(e) = self.handle_interrupted_messages(false).await {
|
||||
eprintln!("Error handling interruption: {}", e);
|
||||
}
|
||||
output::render_error(
|
||||
"The error above was an exception we were not able to handle.\n\
|
||||
These errors are often related to connection or authentication\n\
|
||||
We've removed the conversation up to the most recent user message\n\
|
||||
- depending on the error you may be able to continue",
|
||||
);
|
||||
|
||||
// Check if it's a ProviderError::ContextLengthExceeded
|
||||
if e.downcast_ref::<goose::providers::errors::ProviderError>()
|
||||
.map(|provider_error| matches!(provider_error, goose::providers::errors::ProviderError::ContextLengthExceeded(_)))
|
||||
.unwrap_or(false) {
|
||||
output::render_error(
|
||||
"Context length exceeded error.\n\
|
||||
The conversation is too long for the model's context window.\n\
|
||||
Consider using /summarize to condense the conversation history\n\
|
||||
or /clear to start fresh.\n\
|
||||
We've removed the conversation up to the most recent user message.",
|
||||
);
|
||||
} else {
|
||||
output::render_error(
|
||||
"The error above was an exception we were not able to handle.\n\
|
||||
These errors are often related to connection or authentication\n\
|
||||
We've removed the conversation up to the most recent user message\n\
|
||||
- depending on the error you may be able to continue",
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
None => break,
|
||||
|
||||
Reference in New Issue
Block a user