MCPcopy
hub / github.com/TanStack/ai / sendText

Method sendText

packages/ai-client/src/realtime-client.ts:205–221  ·  view source on GitHub ↗

* Send a text message instead of voice.

(text: string)

Source from the content-addressed store, hash-verified

203 * Send a text message instead of voice.
204 */
205 sendText(text: string): void {
206 if (!this.connection || this.state.status !== 'connected') {
207 return
208 }
209
210 // Add user message
211 const userMessage: RealtimeMessage = {
212 id: this.generateId(),
213 role: 'user',
214 timestamp: Date.now(),
215 parts: [{ type: 'text', content: text }],
216 }
217 this.addMessage(userMessage)
218
219 // Send to provider
220 this.connection.sendText(text)
221 }
222
223 /**
224 * Send an image to the conversation.

Callers 1

useRealtimeChatFunction · 0.80

Calls 3

generateIdMethod · 0.95
addMessageMethod · 0.95
nowMethod · 0.80

Tested by

no test coverage detected