Skip to content

fix: prompt user to model selection when throttled and retry their prompt #2344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
31 changes: 26 additions & 5 deletions crates/chat-cli/src/cli/chat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,12 +776,33 @@ impl ChatSession {
("Amazon Q is having trouble responding right now", eyre!(err), false)
},
ApiClientError::ModelOverloadedError { request_id, .. } => {
let model_instruction = if self.interactive {
"Please use '/model' to select a different model and try again."
} else {
"Please relaunch with '--model <model_id>' to use a different model."
};
if self.interactive {
execute!(
self.stderr,
style::SetAttribute(Attribute::Bold),
style::SetForegroundColor(Color::Red),
style::Print(
"\nThe model you've selected is temporarily unavailable. Please select a different model and try again.\n"
),
style::SetAttribute(Attribute::Reset),
style::SetForegroundColor(Color::Reset),
)?;

if let Some(id) = request_id {
self.conversation
.append_transcript(format!("Model unavailable (Request ID: {})", id));
}

// trigger /model for user
self.inner = Some(ChatState::HandleInput {
input: "/model".to_string(),
});

return Ok(());
}

// non-interactive throws this error
let model_instruction = "Please relaunch with '--model <model_id>' to use a different model.";
let err = format!(
"The model you've selected is temporarily unavailable. {}{}\n\n",
model_instruction,
Expand Down
Loading