Skip to content

Commit

Permalink
Update index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
sxjeru authored Jul 31, 2024
1 parent 8b6890f commit aee9d33
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libs/agent-runtime/google/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
} from '@google/generative-ai';
import { JSONSchema7 } from 'json-schema';
import { transform } from 'lodash-es';
import * as fs from 'node:fs';
import { Buffer } from 'node:buffer';


import { LobeRuntimeAI } from '../BaseAI';
import { AgentRuntimeErrorType, ILobeAgentRuntimeErrorType } from '../error';
import {
Expand Down Expand Up @@ -53,6 +53,7 @@ export class LobeGoogleAI implements LobeRuntimeAI {
async chat(payload: ChatStreamPayload, options?: ChatCompetitionOptions) {
async function imageUrlToBase64(imageUrl: string): Promise<string> {
try {
const fs = await import('node:fs');
const imageData = await fs.promises.readFile(imageUrl);
const base64Image = Buffer.from(imageData).toString('base64');
return base64Image;
Expand Down

0 comments on commit aee9d33

Please sign in to comment.