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:
@ -191,7 +191,10 @@ func (chat *Chat) AddImage(imageName string, image []byte, query *string) error
|
|||||||
extension := filepath.Ext(imageName)
|
extension := filepath.Ext(imageName)
|
||||||
if len(extension) == 0 {
|
if len(extension) == 0 {
|
||||||
// TODO: could also validate for image types we support.
|
// 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:]
|
extension = extension[1:]
|
||||||
@ -216,12 +219,6 @@ func (chat *Chat) AddImage(imageName string, image []byte, query *string) error
|
|||||||
index += 1
|
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{
|
messageContent.Content[index] = ImageMessageContent{
|
||||||
ImageType: "image_url",
|
ImageType: "image_url",
|
||||||
ImageUrl: ImageMessageUrl{
|
ImageUrl: ImageMessageUrl{
|
||||||
|
Reference in New Issue
Block a user