diff --git a/backend/agents/client/chat.go b/backend/agents/client/chat.go index 6f8cadd..23ccc99 100644 --- a/backend/agents/client/chat.go +++ b/backend/agents/client/chat.go @@ -216,6 +216,12 @@ 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{ diff --git a/backend/main.go b/backend/main.go index 31cd2a7..18a878a 100644 --- a/backend/main.go +++ b/backend/main.go @@ -91,6 +91,10 @@ func main() { // TODO: this could be part of the db table extension := filepath.Ext(image.ImageName) + if len(extension) == 0 { + // Same hack + extension = "png" + } extension = extension[1:] w.Header().Add("Content-Type", "image/"+extension)