MCPcopy Create free account
hub / github.com/agegr/pi-web / imageSource

Function imageSource

components/MessageView.tsx:1311–1319  ·  view source on GitHub ↗
(img: ImageContent)

Source from the content-addressed store, hash-verified

1309}
1310
1311function imageSource(img: ImageContent): string {
1312 const flat = img as unknown as { data?: string; mimeType?: string };
1313 if (img.source) {
1314 return img.source.type === "base64"
1315 ? `data:${img.source.media_type};base64,${img.source.data}`
1316 : img.source.url ?? "";
1317 }
1318 return flat.data ? `data:${flat.mimeType};base64,${flat.data}` : "";
1319}
1320
1321function safeJson(value: unknown): string {
1322 try {

Callers 1

CustomMessageViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected