From 98502f65551ce2a86f46a2223b0736f0d2f5fb03 Mon Sep 17 00:00:00 2001 From: Guilherme Gomes Date: Tue, 27 May 2025 17:46:29 -0300 Subject: [PATCH] fix: resolve build errors and audio transcription issues across chatbot services - Add YAML file loader to tsup.config.ts to fix build compilation errors - Fix OpenAI speechToText method signature across all chatbot services - Correct DifyService constructor parameter order in server.module.ts and channel.service.ts - Add missing OpenAI service dependency injection to EvoaiService - Standardize audio transcription logic in FlowiseService to match N8N implementation - Fix speechToText calls in WhatsApp Baileys and Evolution channel services - Ensure consistent error handling and parameter passing for audio processing This resolves the "Cannot read properties of undefined" errors and ensures all chatbot integrations (OpenAI, N8N, Flowise, EvoAI, Dify, EvolutionBot) properly handle audio message transcription using OpenAI Whisper. --- .../channel/evolution/evolution.channel.service.ts | 2 +- .../integrations/channel/whatsapp/whatsapp.baileys.service.ts | 4 ++-- .../chatbot/evolutionBot/services/evolutionBot.service.ts | 2 +- src/api/server.module.ts | 2 +- src/api/services/channel.service.ts | 2 +- tsup.config.ts | 1 + 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/api/integrations/channel/evolution/evolution.channel.service.ts b/src/api/integrations/channel/evolution/evolution.channel.service.ts index b3b937fe..34c885d5 100644 --- a/src/api/integrations/channel/evolution/evolution.channel.service.ts +++ b/src/api/integrations/channel/evolution/evolution.channel.service.ts @@ -165,7 +165,7 @@ export class EvolutionStartupService extends ChannelStartupService { openAiDefaultSettings.speechToText && received?.message?.audioMessage ) { - messageRaw.message.speechToText = await this.openaiService.speechToText(received); + messageRaw.message.speechToText = await this.openaiService.speechToText(received, this); } } diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index d09b8c26..dbdd01d0 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -1298,7 +1298,7 @@ export class BaileysStartupService extends ChannelStartupService { }); if (openAiDefaultSettings && openAiDefaultSettings.openaiCredsId && openAiDefaultSettings.speechToText) { - messageRaw.message.speechToText = await this.openaiService.speechToText(received); + messageRaw.message.speechToText = await this.openaiService.speechToText(received, this); } } @@ -2324,7 +2324,7 @@ export class BaileysStartupService extends ChannelStartupService { }); if (openAiDefaultSettings && openAiDefaultSettings.openaiCredsId && openAiDefaultSettings.speechToText) { - messageRaw.message.speechToText = await this.openaiService.speechToText(messageRaw); + messageRaw.message.speechToText = await this.openaiService.speechToText(messageRaw, this); } } diff --git a/src/api/integrations/chatbot/evolutionBot/services/evolutionBot.service.ts b/src/api/integrations/chatbot/evolutionBot/services/evolutionBot.service.ts index c6149583..edfba052 100644 --- a/src/api/integrations/chatbot/evolutionBot/services/evolutionBot.service.ts +++ b/src/api/integrations/chatbot/evolutionBot/services/evolutionBot.service.ts @@ -62,7 +62,7 @@ export class EvolutionBotService extends BaseChatbotService