🐛 fix(manager.py): prevent base64 encoding of already encoded image data

The code now checks if the image data is already a string before attempting to base64 encode it. This prevents double encoding of the image data.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-22 19:22:30 -03:00
commit 9255f66a5d

View file

@ -144,6 +144,8 @@ class ChatManager:
if isinstance(msg, FileResponse):
if msg.data_type == "image":
# Base64 encode the image
if isinstance(msg.data, str):
continue
msg.data = pil_to_base64(msg.data)
file_responses.append(msg)
if msg.type == "start":