Skip to content

Commit

Permalink
shouldUseBase64 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
denizekiz authored and monilpat committed Jan 2, 2025
1 parent 13c62ce commit 9ea2449
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/plugin-node/src/services/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,22 @@ export class ImageDescriptionService
): Promise<string> {
for (let attempt = 0; attempt < 3; attempt++) {
try {
const shouldUseBase64 = isGif || isLocalFile;
const shouldUseBase64 = (isGif || isLocalFile)&& !(this.runtime.imageModelProvider === ModelProviderName.OPENAI);
const mimeType = isGif
? "png"
: path.extname(imageUrl).slice(1) || "jpeg";

const base64Data = imageData.toString("base64");
//const imageUrlToUse = shouldUseBase64
// ? `data:image/${mimeType};base64,${base64Data}`
//: imageUrl;
const imageUrlToUse = shouldUseBase64
? `data:image/${mimeType};base64,${base64Data}`
: imageUrl;

const content = [
{ type: "text", text: prompt },
{
type: "image_url",
image_url: {
url: imageUrl,
url: imageUrlToUse,
},
},
];
Expand Down

0 comments on commit 9ea2449

Please sign in to comment.