MCPcopy Index your code
hub / github.com/AI45Lab/Code / send_with_attachments

Method send_with_attachments

sdk/node/src/lib.rs:3466–3485  ·  view source on GitHub ↗
(
        &self,
        prompt: String,
        attachments: Vec<AttachmentObject>,
        history: Option<Vec<MessageObject>>,
    )

Source from the content-addressed store, hash-verified

3464 /// @param history - Optional conversation history
3465 #[napi]
3466 pub async fn send_with_attachments(
3467 &self,
3468 prompt: String,
3469 attachments: Vec<AttachmentObject>,
3470 history: Option<Vec<MessageObject>>,
3471 ) -> napi::Result<AgentResult> {
3472 let rust_attachments = js_attachments_to_rust(&attachments);
3473 let rust_history = history.map(|h| js_messages_to_rust(&h)).transpose()?;
3474 let session = self.inner.clone();
3475 let result = get_runtime()
3476 .spawn(async move {
3477 session
3478 .send_with_attachments(&prompt, &rust_attachments, rust_history.as_deref())
3479 .await
3480 })
3481 .await
3482 .map_err(|e| napi::Error::from_reason(format!("Task join error: {e}")))?
3483 .map_err(|e| napi::Error::from_reason(format!("Agent execution failed: {e}")))?;
3484 Ok(AgentResult::from(result))
3485 }
3486
3487 /// Stream a prompt with image attachments.
3488 ///

Callers 1

send_session_requestFunction · 0.45

Calls 5

js_attachments_to_rustFunction · 0.85
js_messages_to_rustFunction · 0.85
get_runtimeFunction · 0.70
cloneMethod · 0.45
spawnMethod · 0.45

Tested by

no test coverage detected