(
outputItem: { result?: string; id?: string; output_format?: string },
options: ICommonObject
)
| 478 | |
| 479 | /** Saves base64 image data to storage and returns file information */ |
| 480 | export const saveBase64Image = async ( |
| 481 | outputItem: { result?: string; id?: string; output_format?: string }, |
| 482 | options: ICommonObject |
| 483 | ): Promise<ISavedImageResult | null> => { |
| 484 | try { |
| 485 | if (!outputItem.result) return null |
| 486 | const outputFormat = outputItem.output_format || 'png' |
| 487 | const fileName = `generated_image_${outputItem.id || Date.now()}.${outputFormat}` |
| 488 | const mimeType = outputFormat === 'png' ? 'image/png' : 'image/jpeg' |
| 489 | return await saveImageToStorage(outputItem.result, mimeType, fileName, options) |
| 490 | } catch (error) { |
| 491 | console.error('Error saving base64 image:', error) |
| 492 | return null |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | /** Saves a Gemini inline image to storage. */ |
| 497 | export const saveGeminiInlineImage = async ( |
no test coverage detected