MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / toImageUrl

Function toImageUrl

web/src/app/api/v1/token-count/_post.ts:273–279  ·  view source on GitHub ↗
(image: unknown, mediaType?: string)

Source from the content-addressed store, hash-verified

271}
272
273function toImageUrl(image: unknown, mediaType?: string): string | null {
274 if (typeof image !== 'string' || !image) return null
275 if (image.startsWith('http://') || image.startsWith('https://') || image.startsWith('data:')) {
276 return image
277 }
278 return `data:${mediaType ?? 'image/png'};base64,${image}`
279}
280
281function extractTextParts(content: Array<Record<string, unknown>>): string {
282 const parts: string[] = []

Callers 1

buildMessageContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected