Skip to content

Commit 9ea2449

Browse files
denizekizmonilpat
authored andcommitted
shouldUseBase64 fix
1 parent 13c62ce commit 9ea2449

File tree

1 file changed

+5
-5
lines changed
  • packages/plugin-node/src/services

1 file changed

+5
-5
lines changed

packages/plugin-node/src/services/image.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -187,22 +187,22 @@ export class ImageDescriptionService
187187
): Promise<string> {
188188
for (let attempt = 0; attempt < 3; attempt++) {
189189
try {
190-
const shouldUseBase64 = isGif || isLocalFile;
190+
const shouldUseBase64 = (isGif || isLocalFile)&& !(this.runtime.imageModelProvider === ModelProviderName.OPENAI);
191191
const mimeType = isGif
192192
? "png"
193193
: path.extname(imageUrl).slice(1) || "jpeg";
194194

195195
const base64Data = imageData.toString("base64");
196-
//const imageUrlToUse = shouldUseBase64
197-
// ? `data:image/${mimeType};base64,${base64Data}`
198-
//: imageUrl;
196+
const imageUrlToUse = shouldUseBase64
197+
? `data:image/${mimeType};base64,${base64Data}`
198+
: imageUrl;
199199

200200
const content = [
201201
{ type: "text", text: prompt },
202202
{
203203
type: "image_url",
204204
image_url: {
205-
url: imageUrl,
205+
url: imageUrlToUse,
206206
},
207207
},
208208
];

0 commit comments

Comments
 (0)