(
db: &SqlitePool,
session_id: &str,
content: &str,
provider_id: Option<&str>,
model_id: Option<&str>,
on_token: Channel<String>,
app_handle: &AppHandle,
cancel_token:
| 206 | |
| 207 | #[allow(clippy::too_many_arguments)] |
| 208 | pub async fn send_message( |
| 209 | db: &SqlitePool, |
| 210 | session_id: &str, |
| 211 | content: &str, |
| 212 | provider_id: Option<&str>, |
| 213 | model_id: Option<&str>, |
| 214 | on_token: Channel<String>, |
| 215 | app_handle: &AppHandle, |
| 216 | cancel_token: CancellationToken, |
| 217 | ) -> AppResult<()> { |
| 218 | let result = send_message_inner( |
| 219 | db, |
| 220 | session_id, |
| 221 | content, |
| 222 | provider_id, |
| 223 | model_id, |
| 224 | on_token, |
| 225 | app_handle, |
| 226 | cancel_token, |
| 227 | ) |
| 228 | .await; |
| 229 | match &result { |
| 230 | Err(AppError::Cancelled) => { |
| 231 | let _ = app_handle.emit("chat-done", "cancelled"); |
| 232 | return Ok(()); |
| 233 | } |
| 234 | Err(ref error) => { |
| 235 | let _ = app_handle.emit("chat-error", error.to_string()); |
| 236 | } |
| 237 | _ => {} |
| 238 | } |
| 239 | result |
| 240 | } |
| 241 | |
| 242 | #[allow(clippy::too_many_arguments)] |
| 243 | async fn send_message_inner( |
nothing calls this directly
no test coverage detected