MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / parseOpenAIStyleImageResponse

Function parseOpenAIStyleImageResponse

ai/ai.ts:1858–1872  ·  view source on GitHub ↗
(data: any)

Source from the content-addressed store, hash-verified

1856
1857const parseOpenAIStyleImageResponse = (data: any): AIImage[] => {
1858 const images: AIImage[] = [];
1859 const list = data?.data || [];
1860 for (const item of list) {
1861 if (item?.b64_json) {
1862 images.push({
1863 data: Buffer.from(item.b64_json, "base64"),
1864 mimeType: "image/png",
1865 });
1866 } else if (item?.url) {
1867 images.push({ url: item.url, mimeType: "image/png" });
1868 }
1869 }
1870 return images;
1871};
1872
1873const isAsyncIterable = (value: any): value is AsyncIterable<any> =>
1874 !!value && typeof value[Symbol.asyncIterator] === "function";
1875

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected