(
state: State<'_, AppState>,
coordinator: State<'_, Arc<ConversationCoordinator>>,
request: BtwCancelRequest,
)
| 43 | |
| 44 | #[tauri::command] |
| 45 | pub async fn btw_cancel( |
| 46 | state: State<'_, AppState>, |
| 47 | coordinator: State<'_, Arc<ConversationCoordinator>>, |
| 48 | request: BtwCancelRequest, |
| 49 | ) -> Result<(), String> { |
| 50 | if request.request_id.trim().is_empty() { |
| 51 | return Err("requestId is required".to_string()); |
| 52 | } |
| 53 | |
| 54 | state |
| 55 | .side_question_runtime |
| 56 | .cancel(&request.request_id) |
| 57 | .await; |
| 58 | if let Some(active_turn) = state |
| 59 | .side_question_runtime |
| 60 | .get_btw_turn(&request.request_id) |
| 61 | .await |
| 62 | { |
| 63 | coordinator |
| 64 | .cancel_dialog_turn(&active_turn.session_id, &active_turn.turn_id) |
| 65 | .await |
| 66 | .map_err(|e| e.to_string())?; |
| 67 | state |
| 68 | .side_question_runtime |
| 69 | .remove(&request.request_id) |
| 70 | .await; |
| 71 | } |
| 72 | Ok(()) |
| 73 | } |
| 74 | |
| 75 | #[tauri::command] |
| 76 | pub async fn btw_ask_stream( |
nothing calls this directly
no test coverage detected