MCPcopy Index your code
hub / github.com/TanStack/ai / sendImage

Method sendImage

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

* Send an image to the conversation. * @param imageData - Base64-encoded image data or a URL * @param mimeType - MIME type of the image (e.g., 'image/png', 'image/jpeg')

(imageData: string, mimeType: string)

Source from the content-addressed store, hash-verified

226 * @param mimeType - MIME type of the image (e.g., 'image/png', 'image/jpeg')
227 */
228 sendImage(imageData: string, mimeType: string): void {
229 if (!this.connection || this.state.status !== 'connected') {
230 return
231 }
232
233 // Add user message with image part
234 const userMessage: RealtimeMessage = {
235 id: this.generateId(),
236 role: 'user',
237 timestamp: Date.now(),
238 parts: [{ type: 'image', data: imageData, mimeType }],
239 }
240 this.addMessage(userMessage)
241
242 // Send to provider
243 this.connection.sendImage(imageData, mimeType)
244 }
245
246 // ============================================================================
247 // State Access

Callers 1

useRealtimeChatFunction · 0.80

Calls 3

generateIdMethod · 0.95
addMessageMethod · 0.95
nowMethod · 0.80

Tested by

no test coverage detected