Skip to content

Commit c75e958

Browse files
committed
Fixed a couple of coderabbit comments
1 parent 1e0e15d commit c75e958

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

packages/typescript/ai-gemini/src/adapters/image.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ export class GeminiImageAdapter<
155155
const parts = response.candidates?.[0]?.content?.parts ?? []
156156

157157
for (const part of parts) {
158-
if (part.inlineData) {
158+
if (
159+
part.inlineData?.data &&
160+
typeof part.inlineData.data === 'string' &&
161+
part.inlineData.data.length > 0
162+
) {
159163
images.push({ b64Json: part.inlineData.data })
160164
}
161165
}

packages/typescript/ai-gemini/tests/image-adapter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ describe('Gemini Image Adapter', () => {
283283
expect(result.images[0].b64Json).toBe('gemini-base64-image')
284284
})
285285

286-
it('calls generateContent without imageGenerationConfig when no size provided', async () => {
286+
it('calls generateContent without imageConfig when no size provided', async () => {
287287
const mockResponse = {
288288
candidates: [
289289
{

0 commit comments

Comments
 (0)