* 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)
| 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 |
no test coverage detected