Skip to content

Commit 6559eaf

Browse files
committed
Avoid "Unable to submit request because it must have a text parameter"
when image_url specified without text message
1 parent c74293b commit 6559eaf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/worker.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ const transformMsg = async ({ role, content }) => {
298298
throw new TypeError(`Unknown "content" item type: "${item.type}"`);
299299
}
300300
}
301+
if (content.every(item => item.type === "image_url")) {
302+
parts.push({ text: "" }); // to avoid "Unable to submit request because it must have a text parameter"
303+
}
301304
return { role, parts };
302305
};
303306

0 commit comments

Comments
 (0)