File tree 1 file changed +9
-1
lines changed
crates/q_cli/src/cli/chat
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,8 @@ const HELP_TEXT: &str = color_print::cstr! {"
160
160
161
161
" } ;
162
162
163
+ const RESPONSE_TIMEOUT_CONTENT : & str = "Response timed out - message took too long to generate" ;
164
+
163
165
pub async fn chat (
164
166
input : Option < String > ,
165
167
no_interactive : bool ,
@@ -1509,6 +1511,7 @@ where
1509
1511
}
1510
1512
1511
1513
async fn handle_response ( & mut self , response : SendMessageOutput ) -> Result < ChatState , ChatError > {
1514
+ let request_id = response. request_id ( ) . map ( |s| s. to_string ( ) ) ;
1512
1515
let mut buf = String :: new ( ) ;
1513
1516
let mut offset = 0 ;
1514
1517
let mut ended = false ;
@@ -1545,6 +1548,11 @@ where
1545
1548
tool_name_being_recvd = None ;
1546
1549
} ,
1547
1550
parser:: ResponseEvent :: EndStream { message } => {
1551
+ // This log is attempting to help debug instances where users encounter
1552
+ // the response timeout message.
1553
+ if message. content == RESPONSE_TIMEOUT_CONTENT {
1554
+ error ! ( ?request_id, ?message, "Encountered an unexpected model response" ) ;
1555
+ }
1548
1556
self . conversation_state . push_assistant_message ( message) ;
1549
1557
ended = true ;
1550
1558
} ,
@@ -1573,7 +1581,7 @@ where
1573
1581
self . conversation_state
1574
1582
. push_assistant_message ( AssistantResponseMessage {
1575
1583
message_id : None ,
1576
- content : "Response timed out - message took too long to generate" . to_string ( ) ,
1584
+ content : RESPONSE_TIMEOUT_CONTENT . to_string ( ) ,
1577
1585
tool_uses : None ,
1578
1586
} ) ;
1579
1587
self . conversation_state
You can’t perform that action at this time.
0 commit comments