Handle dialog turn cancellation
(&mut self)
| 821 | |
| 822 | /// Handle dialog turn cancellation |
| 823 | pub fn handle_turn_cancelled(&mut self) { |
| 824 | if let Some(last_msg) = self.messages.last_mut() { |
| 825 | if last_msg.role == MessageRole::Assistant { |
| 826 | last_msg.is_streaming = false; |
| 827 | last_msg.flow_items.push(FlowItem::Text { |
| 828 | content: "[Cancelled]".to_string(), |
| 829 | is_streaming: false, |
| 830 | }); |
| 831 | last_msg.version += 1; |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | self.current_turn_id = None; |
| 836 | self.current_flow_items.clear(); |
| 837 | self.tool_index.clear(); |
| 838 | self.is_processing = false; |
| 839 | self.permission_prompt = None; |
| 840 | self.question_prompt = None; |
| 841 | } |
| 842 | |
| 843 | /// Handle token usage update |
| 844 | pub fn handle_token_usage(&mut self, total_tokens: usize) { |