This commit is contained in:
曹亚文 2026-01-31 00:33:43 +08:00 committed by GitHub
commit 7773d8e30d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,6 +39,14 @@ function extractImages(message: unknown): ImageBlock[] {
? data
: `data:${mediaType};base64,${data}`;
images.push({ url });
} else if (typeof b.data === "string" && typeof b.mimeType === "string") {
// Handle tool result format: { type: "image", data: "base64...", mimeType: "image/png" }
const data = b.data as string;
const mimeType = b.mimeType as string;
const url = data.startsWith("data:")
? data
: `data:${mimeType};base64,${data}`;
images.push({ url });
} else if (typeof b.url === "string") {
images.push({ url: b.url });
}