Skip to content

Commit

Permalink
Avoid "Unable to submit request because it must have a text parameter"
Browse files Browse the repository at this point in the history
when image_url specified without text message
  • Loading branch information
johnd0e committed Jan 4, 2025
1 parent c74293b commit 6559eaf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/worker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ const transformMsg = async ({ role, content }) => {
throw new TypeError(`Unknown "content" item type: "${item.type}"`);
}
}
if (content.every(item => item.type === "image_url")) {
parts.push({ text: "" }); // to avoid "Unable to submit request because it must have a text parameter"
}
return { role, parts };
};

Expand Down

0 comments on commit 6559eaf

Please sign in to comment.