Skip to content

Commit

Permalink
Merge pull request #1071 from AlanCezarAraujo/fix/openai-audio
Browse files Browse the repository at this point in the history
Correção de envio de áudio para OpenAI via Cloud API
  • Loading branch information
DavidsonGomes authored Nov 21, 2024
2 parents 09a33a4 + 1d55087 commit 52b6b61
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/api/integrations/channel/meta/whatsapp.business.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
},
() => {},
);
}
}
Expand Down

0 comments on commit 52b6b61

Please sign in to comment.