From 9255f66a5da24ca61c6be8b8436f1baf1c00dd51 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 22 Jun 2023 19:22:30 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(manager.py):=20prevent=20bas?= =?UTF-8?q?e64=20encoding=20of=20already=20encoded=20image=20data=20The=20?= =?UTF-8?q?code=20now=20checks=20if=20the=20image=20data=20is=20already=20?= =?UTF-8?q?a=20string=20before=20attempting=20to=20base64=20encode=20it.?= =?UTF-8?q?=20This=20prevents=20double=20encoding=20of=20the=20image=20dat?= =?UTF-8?q?a.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/chat/manager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/langflow/chat/manager.py b/src/backend/langflow/chat/manager.py index 7c3a08240..4a1b8e77c 100644 --- a/src/backend/langflow/chat/manager.py +++ b/src/backend/langflow/chat/manager.py @@ -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":