fix: support HTTP/HTTPS image URLs in Claude and Gemini translators (#344)

Previously only base64 data: URLs were handled in the OpenAI-to-Claude
and OpenAI-to-Gemini request translators. HTTP/HTTPS image URLs were
silently dropped, causing vision-capable models to respond with
"I don't see any image."
This commit is contained in:
Ryan
2026-03-23 14:56:40 +07:00
committed by GitHub
parent 8df8b94180
commit 99cb9ed11f
2 changed files with 9 additions and 0 deletions
@@ -216,6 +216,11 @@ function getContentBlocksFromMessage(msg, toolNameMap = new Map()) {
type: "image",
source: { type: "base64", media_type: match[1], data: match[2] }
});
} else if (url.startsWith("http://") || url.startsWith("https://")) {
blocks.push({
type: "image",
source: { type: "url", url }
});
}
} else if (part.type === "image" && part.source) {
blocks.push({ type: "image", source: part.source });