Skip to content

Commit 6665ff4

Browse files
authored
fix(chat ux): exit thinking state using ctrl + c (#1072)
1 parent 02c3ffe commit 6665ff4

File tree

1 file changed

+7
-1
lines changed
  • crates/q_cli/src/cli/chat

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,13 @@ where
417417
}
418418
self.prompt_user(tool_uses, skip_printing_tools).await
419419
},
420-
ChatState::HandleInput { input, tool_uses } => self.handle_input(input, tool_uses).await,
420+
ChatState::HandleInput { input, tool_uses } => {
421+
let tool_uses_clone = tool_uses.clone().unwrap();
422+
tokio::select! {
423+
res = self.handle_input(input, tool_uses) => res,
424+
Some(_) = ctrl_c_stream.recv() => Err(ChatError::Interrupted { tool_uses: Some(tool_uses_clone) })
425+
}
426+
},
421427
ChatState::ExecuteTools(tool_uses) => {
422428
let tool_uses_clone = tool_uses.clone();
423429
tokio::select! {

0 commit comments

Comments
 (0)