( base64Data: string, mediaType: string, filename: string, tempPath?: string, )
| 88 | * Process an image from base64 data and add it to the pending images state. |
| 89 | */ |
| 90 | export async function addPendingImageFromBase64( |
| 91 | base64Data: string, |
| 92 | mediaType: string, |
| 93 | filename: string, |
| 94 | tempPath?: string, |
| 95 | ): Promise<void> { |
| 96 | // For base64 images (like clipboard), we already have the data |
| 97 | // Check size and add directly |
| 98 | const size = Math.round((base64Data.length * 3) / 4) // Approximate decoded size |
| 99 | |
| 100 | useChatStore.getState().addPendingImage({ |
| 101 | path: tempPath || `clipboard:${filename}`, |
| 102 | filename, |
| 103 | status: 'ready', |
| 104 | size, |
| 105 | processedImage: { |
| 106 | base64: base64Data, |
| 107 | mediaType, |
| 108 | }, |
| 109 | }) |
| 110 | } |
| 111 | |
| 112 | const AUTO_REMOVE_ERROR_DELAY_MS = 3000 |
| 113 |
no outgoing calls
no test coverage detected