From 1319371446c667004d83f8946240f4e37c5d9b08 Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 5 Dec 2023 08:18:39 +0100 Subject: [PATCH] Handle mp3 attachments as audio messages Extended the condition for the audio message handling in the chatbot to recognize MP3 audio files sent as file attachments. This ensures that MP3 files will be properly processed as audio messages, improving the bot's media handling capabilities. This is just a test at this point, and may be rolled back. --- src/gptbot/classes/bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gptbot/classes/bot.py b/src/gptbot/classes/bot.py index 692cfca..bd12bb6 100644 --- a/src/gptbot/classes/bot.py +++ b/src/gptbot/classes/bot.py @@ -1146,7 +1146,7 @@ class GPTBot: message_body = message.body if not self.chat_api.supports_chat_images() else [{"type": "text", "text": message.body}] chat_messages.append({"role": role, "content": message_body}) - if isinstance(message, RoomMessageAudio): + if isinstance(message, RoomMessageAudio) or (isinstance(message, RoomMessageFile) and message.body.endswith(".mp3")): role = ( "assistant" if message.sender == self.matrix_client.user_id else "user" )