Skip to content

Commit

Permalink
Use mimetypes for MIME type detection in image processing (#100)
Browse files Browse the repository at this point in the history
Fixes #99
  • Loading branch information
aaclause committed Apr 27, 2024
1 parent b3a31b9 commit bc55957
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addon/globalPlugins/openai/maindialog.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import json
import mimetypes
import os
import re
import speech
Expand Down Expand Up @@ -1362,8 +1363,7 @@ def getImages(
)
path = path_resized_image
base64_image = encode_image(path)
format = path.split(".")[-1]
mime_type = f"image/{format}"
mime_type, _ = mimetypes.guess_type(path)
images.append({
"type": "image_url",
"image_url": {
Expand Down

0 comments on commit bc55957

Please sign in to comment.