bubble up the mime type

This commit is contained in:
2025-07-21 23:14:55 -04:00
parent e0adc40661
commit 31766134ef
2 changed files with 21 additions and 35 deletions

View File

@@ -90,7 +90,7 @@ func (a anthropic) requestToAnthropicRequest(req Request) anth.MessagesRequest {
// Check if image size exceeds 5MiB (5242880 bytes)
if len(raw) >= 5242880 {
compressed, err := utils.CompressImage(img.Base64, 5*1024*1024)
compressed, mime, err := utils.CompressImage(img.Base64, 5*1024*1024)
// just replace the image with the compressed one
if err != nil {
@@ -98,6 +98,7 @@ func (a anthropic) requestToAnthropicRequest(req Request) anth.MessagesRequest {
}
img.Base64 = compressed
img.ContentType = mime
}
m.Content = append(m.Content, anth.NewImageMessageContent(