@@ -138,8 +138,9 @@ class Chatgpt(SimpleService): kind = filetype.guess(input_message.file.read(20)) mime = kind.mime if kind else 'application/octet-stream' normalized_image = Image.open(image) + format = 'jpeg' if kind.extension == 'jpg' else kind.extension buf = BytesIO() - normalized_image.save(buf, format=kind.extension.upper()) + normalized_image.save(buf, format=format) image_url = ( f'data:{mime},base64,{base64.b64encode(buf.getvalue()).decode("utf-8")}' ) @@ -198,6 +199,7 @@ class Chatgpt(SimpleService): ) if image: response = self.llm.invoke([llm_input]) + print('gay') chat_history.chat_memory.add_ai_message(response) elif file: human_messages = []