File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -175,14 +175,18 @@ impl StreamingClient {
175
175
&& e. raw_response ( ) . is_some_and ( |resp| resp. status ( ) . as_u16 ( ) == 500 )
176
176
&& e. as_service_error ( ) . is_some_and ( |err| {
177
177
err. meta ( ) . message ( )
178
- == Some ( "Encountered unexpectedly high load when processing the request, please try again." )
178
+ == Some ( "Encountered unexpectedly high load when processing the request, please try again." )
179
179
} ) ;
180
180
if is_quota_breach {
181
181
Err ( ApiClientError :: QuotaBreach ( "quota has reached its limit" ) )
182
182
} else if is_context_window_overflow {
183
183
Err ( ApiClientError :: ContextWindowOverflow )
184
184
} else if is_model_unavailable {
185
- Err ( ApiClientError :: ModelOverloadedError ( ) )
185
+ let request_id = e
186
+ . as_service_error ( )
187
+ . and_then ( |err| err. meta ( ) . request_id ( ) )
188
+ . map ( |s| s. to_string ( ) ) ;
189
+ Err ( ApiClientError :: ModelOverloadedError ( request_id) )
186
190
} else {
187
191
Err ( e. into ( ) )
188
192
}
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ pub enum ApiClientError {
69
69
#[ error(
70
70
"The model you've selected is temporarily unavailable. Please use '/model' to select a different model and try again."
71
71
) ]
72
- ModelOverloadedError ( ) ,
72
+ ModelOverloadedError ( Option < String > ) ,
73
73
}
74
74
75
75
#[ cfg( test) ]
Original file line number Diff line number Diff line change @@ -1086,6 +1086,23 @@ impl ChatContext {
1086
1086
crate :: api_client:: ApiClientError :: QuotaBreach ( msg) => {
1087
1087
print_err ! ( msg, err) ;
1088
1088
} ,
1089
+ crate :: api_client:: ApiClientError :: ModelOverloadedError ( request_id) => {
1090
+ queue ! (
1091
+ self . output,
1092
+ style:: SetAttribute ( Attribute :: Bold ) ,
1093
+ style:: SetForegroundColor ( Color :: Red ) ,
1094
+ ) ?;
1095
+ let message = "The model you've selected is temporarily unavailable. Please use '/model' to select a different model and try again." ;
1096
+ queue ! (
1097
+ self . output,
1098
+ style:: Print ( & format!( "{}\n Request ID: {}" , message, request_id) )
1099
+ ) ?;
1100
+ execute ! (
1101
+ self . output,
1102
+ style:: SetAttribute ( Attribute :: Reset ) ,
1103
+ style:: SetForegroundColor ( Color :: Reset ) ,
1104
+ ) ?;
1105
+ } ,
1089
1106
_ => {
1090
1107
print_default_error ! ( err) ;
1091
1108
} ,
You can’t perform that action at this time.
0 commit comments