Handle cancel operation
(os: &Os, session: &ChatSession, operation_id: Option<&str>)
| 466 | |
| 467 | /// Handle cancel operation |
| 468 | async fn handle_cancel(os: &Os, session: &ChatSession, operation_id: Option<&str>) -> OperationResult { |
| 469 | let agent = Self::get_agent(session); |
| 470 | let async_knowledge_store = match KnowledgeStore::get_async_instance(os, agent).await { |
| 471 | Ok(store) => store, |
| 472 | Err(e) => return OperationResult::Error(format!("Error accessing knowledge base directory: {}", e)), |
| 473 | }; |
| 474 | let mut store = async_knowledge_store.lock().await; |
| 475 | |
| 476 | match store.cancel_operation(operation_id).await { |
| 477 | Ok(result) => OperationResult::Success(result), |
| 478 | Err(e) => OperationResult::Error(format!("Failed to cancel operation: {}", e)), |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | /// Validate and sanitize path |
| 483 | fn validate_and_sanitize_path(os: &Os, path: &str) -> Result<String, String> { |
nothing calls this directly
no test coverage detected