Added model and role translation. Rewrite of code's comments.

This commit is contained in:
2025-06-30 12:01:00 -05:00
parent 2370a798d1
commit 37f0c4b643
7 changed files with 379 additions and 109 deletions

View File

@@ -1,3 +1,17 @@
/**
* @fileoverview This file provides a utility function for fetching a remote
* image and encoding it in base64.
*/
/**
* Fetches an image from a URL and returns
* its MIME type and base64-encoded data.
*
* @param url - The URL of the image to fetch.
* @returns A promise that resolves to an object containing the MIME type and
* base64-encoded image data.
* @throws Throws an error if the image fetch fails.
*/
export async function fetchAndEncode(url: string) {
const res = await fetch(url);
if (!res.ok) throw new Error(`Failed to fetch image: ${url}`);