MCPcopy Create free account
hub / github.com/enowdev/enowX-Coder / send_message

Function send_message

src-tauri/src/commands/chat.rs:15–42  ·  view source on GitHub ↗
(
    state: State<'_, AppState>,
    session_id: String,
    content: String,
    provider_id: Option<String>,
    model_id: Option<String>,
    on_token: Channel<String>,
    app_handle: AppHandle,

Source from the content-addressed store, hash-verified

13
14#[tauri::command]
15pub async fn send_message(
16 state: State<'_, AppState>,
17 session_id: String,
18 content: String,
19 provider_id: Option<String>,
20 model_id: Option<String>,
21 on_token: Channel<String>,
22 app_handle: AppHandle,
23) -> AppResult<()> {
24 let cancel_token = state.cancellations.register(format!("chat:{session_id}"));
25
26 let result = chat_service::send_message(
27 state.pool(),
28 &session_id,
29 &content,
30 provider_id.as_deref(),
31 model_id.as_deref(),
32 on_token,
33 &app_handle,
34 cancel_token,
35 )
36 .await;
37
38 // Cleanup the token regardless of outcome
39 state.cancellations.remove(&format!("chat:{session_id}"));
40
41 result
42}
43
44#[tauri::command]
45pub async fn cancel_chat(state: State<'_, AppState>, session_id: String) -> AppResult<()> {

Callers

nothing calls this directly

Calls 3

registerMethod · 0.80
poolMethod · 0.80
removeMethod · 0.80

Tested by

no test coverage detected