in src/tiny_cats/index.ts [65:91]
for await (const chunk of result) {
for (const candidate of chunk.candidates) {
for (const part of candidate.content.parts ?? []) {
if (part.text) {
text += part.text;
} else {
try {
const data = part.inlineData;
if (data) {
img = document.createElement('img');
img.src = `data:image/png;base64,` + data.data;
} else {
console.log('no data', chunk);
}
} catch (e) {
console.log('no data', chunk);
}
}
if (text && img) {
await addSlide(text, img);
slideshow.removeAttribute('hidden');
text = '';
img = null;
}
}
}
}