From 1d5508736eb802884f22bb627f41c06b629f9045 Mon Sep 17 00:00:00 2001 From: Alan Cezar Date: Fri, 15 Nov 2024 17:57:38 -0300 Subject: [PATCH] =?UTF-8?q?corrigido=20o=20envio=20de=20=C3=A1udio=20para?= =?UTF-8?q?=20OpenAI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../channel/meta/whatsapp.business.service.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/api/integrations/channel/meta/whatsapp.business.service.ts b/src/api/integrations/channel/meta/whatsapp.business.service.ts index c44cbb18c..921d0e6d4 100644 --- a/src/api/integrations/channel/meta/whatsapp.business.service.ts +++ b/src/api/integrations/channel/meta/whatsapp.business.service.ts @@ -465,16 +465,23 @@ export class BusinessStartupService extends ChannelStartupService { }, }); + const audioMessage = received?.messages[0]?.audio; + if ( openAiDefaultSettings && openAiDefaultSettings.openaiCredsId && openAiDefaultSettings.speechToText && - received?.message?.audioMessage + audioMessage ) { messageRaw.message.speechToText = await this.openaiService.speechToText( openAiDefaultSettings.OpenaiCreds, - received, - this.client.updateMediaMessage, + { + message: { + mediaUrl: messageRaw.message.mediaUrl, + ...messageRaw, + } + }, + () => {}, ); } }