UNPKG

@tanstack/ai

Version:

Type-safe TypeScript AI SDK for streaming chat, tool calling, agents, structured outputs, and multimodal generation.

44 lines (43 loc) 870 B
function resolveMediaPrompt(prompt) { if (typeof prompt === "string") { const textPart = { type: "text", content: prompt }; return { text: prompt, parts: [textPart], images: [], videos: [], audios: [] }; } const images = []; const videos = []; const audios = []; const textSegments = []; for (const part of prompt) { switch (part.type) { case "text": if (part.content) textSegments.push(part.content); break; case "image": images.push(part); break; case "video": videos.push(part); break; case "audio": audios.push(part); break; } } return { text: textSegments.join("\n\n"), parts: prompt, images, videos, audios }; } export { resolveMediaPrompt }; //# sourceMappingURL=media-prompt.js.map