UNPKG

ai

Version:

AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.

18 lines (17 loc) 387 B
export function splitDataUrl(dataUrl: string): { mediaType: string | undefined; base64Content: string | undefined; } { try { const [header, base64Content] = dataUrl.split(','); return { mediaType: header.split(';')[0].split(':')[1], base64Content, }; } catch (error) { return { mediaType: undefined, base64Content: undefined, }; } }