changed the way images are passed
This commit is contained in:
20
anthropic.go
20
anthropic.go
@@ -58,12 +58,20 @@ func (a anthropic) requestToAnthropicRequest(req Request) anth.MessagesRequest {
|
||||
})
|
||||
}
|
||||
|
||||
if msg.ImageBase64 != "" {
|
||||
m.Content = append(m.Content, anth.NewImageMessageContent(anth.MessageContentImageSource{
|
||||
Type: "base64",
|
||||
MediaType: "image/png",
|
||||
Data: msg.ImageBase64,
|
||||
}))
|
||||
for _, img := range msg.Images {
|
||||
if img.Base64 != "" {
|
||||
m.Content = append(m.Content, anth.NewImageMessageContent(anth.MessageContentImageSource{
|
||||
Type: "base64",
|
||||
MediaType: img.ContentType,
|
||||
Data: img.Base64,
|
||||
}))
|
||||
} else if img.Url != "" {
|
||||
m.Content = append(m.Content, anth.NewImageMessageContent(anth.MessageContentImageSource{
|
||||
Type: "url",
|
||||
MediaType: img.ContentType,
|
||||
Data: img.Url,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
// if this has the same role as the previous message, we can append it to the previous message
|
||||
|
Reference in New Issue
Block a user