fix: the reason this wasn't working

This was also silent failing, so should probably have a look at it
This commit is contained in:
2025-05-11 14:30:31 +01:00
parent a6a6026a11
commit e8a51ecc52

View File

@ -191,7 +191,10 @@ func (chat *Chat) AddImage(imageName string, image []byte, query *string) error
extension := filepath.Ext(imageName)
if len(extension) == 0 {
// TODO: could also validate for image types we support.
return errors.New("Image does not have extension")
// return errors.New("Image does not have extension")
// Hacky! It seems apple doesnt add extension.
// BIG TODO: take better metadata from the image.
extension = "png"
}
extension = extension[1:]
@ -216,12 +219,6 @@ func (chat *Chat) AddImage(imageName string, image []byte, query *string) error
index += 1
}
if len(extension) == 0 {
// Hacky! It seems apple doesnt add extension.
// BIG TODO: take better metadata from the image.
extension = "png"
}
messageContent.Content[index] = ImageMessageContent{
ImageType: "image_url",
ImageUrl: ImageMessageUrl{