-
Notifications
You must be signed in to change notification settings - Fork 5.2k
fix: corrige estrutura de if/else e bloco try/catch em chatwoot-import-helper.ts #1492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Update Docker image repository to evoapicloud/evolution-api - Modify contact email to contato@evolution-api.com - Update Docker Compose, Dockerfile, and workflow files - Add Docker image badge to README - Include additional content creator in README - Implement message deduplication cache in Baileys service
…leys service - Refactor edited message detection logic - Prevent duplicate message processing for edited messages - Optimize message key caching mechanism
…{baseUrl}}/chat/fetchCatalogs' and '{{baseUrl}}/chat/fetchCollections'
Refactor edit and delete message functionality in BaileyStartupService
Feat: Adicionei suporte para obter o Catálogos de Produtos e as Coleções de Produtos para a versão 2.2.3
- Added NATS package to dependencies - Created Prisma schema models for NATS configuration - Implemented NATS controller, router, and event management - Updated instance controller and event manager to support NATS - Added NATS configuration options in environment configuration - Included NATS events in instance validation schema
…gos de produtos e Coleções evitando alterações desnecessárias em arquivos do repositório
Adicionado suporte para obter Catálogos e Coleções no WhatsApp Business
feat: notconvertsticket for animated stickers
Fix instance creation on v2.2.3
feat: add message location support whatsapp meta
Fix audio send duplicate from chatwoot.
fix: chatwoot csat creating new conversation in another language
Corrige problema na API relacionado à migration. Fixes #1234
Fix-chatwoot-import
- Enhanced the logic for converting media messages to base64 by adding a retry mechanism for downloading media if the initial buffer is not available. - This change ensures that media messages are reliably converted to base64 format, improving the robustness of media handling in the WhatsApp integration service. - Updated error logging to capture issues during the media conversion process.
Refatoração da funcionalidade de chatbots (em andamento)
- Adjusted spacing in destructuring assignments for `remoteJid` in multiple locations to enhance code readability and maintain consistency with coding standards. - Removed unnecessary blank lines to streamline the code structure. This commit focuses on improving the overall style of the `whatsapp.baileys.service.ts` file without altering any functionality.
- Changed the type of `keywordFinish` from an array to a string in multiple DTOs and controller interfaces to simplify data handling. - Updated the `BaseChatbotService` to include logic for updating session status to 'opened' and managing user responses more effectively. - Refactored the media message handling in the `BaseChatbotService` to streamline the process and improve readability. - Enhanced error logging across various services to ensure better traceability during operations. This commit focuses on improving the structure and consistency of chatbot integrations while ensuring that session management is robust and user-friendly.
- Added new environment variables for SSL configuration, including `SSL_CONF_PRIVKEY` and `SSL_CONF_FULLCHAIN`, to support secure connections. - Introduced additional webhook configuration options in the `.env.example` file, such as `WEBHOOK_REQUEST_TIMEOUT_MS`, `WEBHOOK_RETRY_MAX_ATTEMPTS`, and related retry settings to improve webhook resilience and error handling. - Updated the `bootstrap` function in `main.ts` to handle SSL certificate loading failures gracefully, falling back to HTTP if necessary. - Enhanced error handling and logging in the `BusinessStartupService` to ensure better traceability and robustness when processing messages. This commit focuses on improving the security and reliability of webhook interactions while ensuring that the application can handle SSL configurations effectively.
- Updated various chatbot services (Typebot, Dify, EvolutionBot, Flowise, N8n) to include the OpenAI service for audio transcription capabilities. - Modified constructors to accept OpenaiService as a dependency, enhancing the ability to transcribe audio messages directly within each service. - Refactored the handling of `keywordFinish` in multiple controllers and services, changing its type from an array to a string for consistency and simplifying logic. - Removed redundant audio transcription logic from the base service, centralizing it within the OpenAI service to improve maintainability and reduce code duplication. This commit focuses on enhancing the chatbot services by integrating OpenAI's transcription capabilities, improving code structure, and ensuring consistent handling of session keywords.
- Integrated OpenAI service into the EvoaiService to streamline audio message transcription. - Updated the constructor to initialize OpenaiService, allowing for direct transcription of audio messages. - Refactored audio message handling to utilize the OpenAI service for improved reliability and maintainability. - Adjusted the processing logic to handle transcription results more effectively, ensuring fallback content is provided when transcription fails. This commit focuses on enhancing the EvoaiService's capabilities by leveraging OpenAI for audio transcription, improving overall service functionality and code structure.
Corrige o problema de formatação nas mensagens do N8n onde quebras de linha extras estavam sendo adicionadas antes e depois das mídias (imagens, vídeos, etc). Agora o texto é enviado mantendo apenas as quebras de linha intencionais.
Corrige o problema onde o Evolution Bot não processava mensagens subsequentes após a primeira resposta. A correção permite que o bot continue respondendo a todas as mensagens enquanto a sessão estiver ativa, melhorando a continuidade da conversa.
Corrige o problema onde o Evolution Bot reativava automaticamente por qualquer mensagem do usuario quando a sessão estava pausada. Agora, quando uma sessão está pausada, o bot ignora completamente as mensagens recebidas até que a sessão seja explicitamente reativada.
Corrige o problema onde o N8N reativava automaticamente a sessão após receber uma mensagem quando estava pausado. Agora, quando uma sessão está pausada, o bot ignora completamente as mensagens recebidas até que a sessão seja explicitamente reativada através do endpoint de mudança de status.
fix: melhora consistência e formatação dos chatbots (N8N e Evolution Bot)
chore: possibilita o envio de medias do tipo [svg, tiff] vindas do Chatwoot
Corrige o envio da apiKey no payload do Evolution Bot para usar a apiKey específica da instância ao invés da apiKey global do sistema.
Corrige o envio da apiKey no payload do N8N para usar a apiKey específica da instância ao invés da apiKey global do sistema.
fix: Corrige envio da apiKey da instância nos payloads do Evolution Bot e N8N
Corrige o envio da apiKey no payload do Flowise para usar a apiKey específica da instância ao invés da apiKey global do sistema.
Corrige o envio da apiKey no payload do Dify para usar a apiKey específica da instância ao invés da apiKey global do sistema.
fix: Corrige envio da apiKey da instância nos payloads do Flowise e do Dify
fix: Corrige o PR1481
…t-helper.ts Esta PR corrige problemas de sintaxe no arquivo chatwoot-import-helper.ts, especificamente: - Ajusta a estrutura do bloco if/else no método getExistingSourceIds, evitando erro de compilação do TypeScript. - Garante que o bloco catch esteja corretamente posicionado dentro do método, retornando null em caso de erro. - Mantém a lógica original do método, apenas corrigindo a sintaxe para permitir a compilação e execução correta do projeto. Essas correções eliminam o erro de build relacionado ao TypeScript e melhoram a robustez do código ao tratar exceções de forma adequada.
Contributor
Reviewer's GuideThis PR refactors getExistingSourceIds in chatwoot-import-helper.ts by updating its signature to accept an optional conversationId, conditionally adding a WHERE filter when conversationId is provided, and replacing the process exit in the catch block with a safe return of an empty set. Sequence Diagram for OpenAI Audio TranscriptionsequenceDiagram
actor User
participant OS as OpenaiService
participant OAI as OpenAI API
User->>OS: process(audio message, ...)
OS->>OS: speechToText(msgOrBuffer, ...)
OS->>OS: getAudioBufferFromMsg(msg, ...)
activate OS
OS-->>OS: audioBuffer
deactivate OS
OS->>OS: processAudioTranscription(audioBuffer)
activate OS
OS->>OAI: Transcribe audio (POST /v1/audio/transcriptions)
OAI-->>OS: transcription text
OS-->>OS: transcription
deactivate OS
OS-->>OS: transcription
OS-->>User: (Sends message with transcribed text or uses it in bot logic)
Sequence Diagram for Typebot Audio Message HandlingsequenceDiagram
actor User
participant TC as TypebotController
participant TS as TypebotService
participant BCS as BaseChatbotService
participant OS as OpenaiService
participant TAPI as Typebot API
participant WA as WhatsApp API
User->>TC: emit(audio message, ...)
TC->>TS: processTypebot(...)
TS->>BCS: process(bot, audio content, ...)
BCS->>TS: sendMessageToBot(audio content, ...)
activate TS
TS->>TS: isAudioMessage(content)
alt Audio Message
TS->>OS: speechToText(msg)
OS-->>TS: transcription
TS->>TAPI: continueChat/sendMessage (with transcription)
else Not Audio Message
TS->>TAPI: continueChat/sendMessage (original content)
end
TAPI-->>TS: Bot Response (messages, input, actions)
deactivate TS
TS->>TS: sendWAMessage(..., response.messages, ...)
activate TS
TS->>WA: Send Formatted Messages (text, media, buttons, list)
deactivate TS
WA-->>User: Bot Messages
Entity Relationship Diagram for EventDto NATS IntegrationerDiagram
EventDto {
object webhook
object sqs
object rabbitmq
object nats
object pusher
object websocket
}
EventDto ||--o{ nats : contains
nats {
boolean enabled "Optional"
string events "Optional, Array of strings"
}
Class Diagram for TypebotService RefactoringclassDiagram
class BaseChatbotService {
+process(...)
}
class OpenaiService {
+speechToText(...)
}
class TypebotService {
+TypebotService(waMonitor, configService, prismaRepository, openaiService: OpenaiService)
+sendWAMessage(instance, session, settings, remoteJid, messages, input, clientSideActions)
+processTypebot(instance, remoteJid, msg, session, bot, ...)
#getBotType(): string
#sendMessageToBot(instance, session, settings, bot, remoteJid, pushName, content, msg?)
-openaiService: OpenaiService
-initTypebotSession(instance, session, bot, remoteJid, pushName, prefilledVariables?)
-processTypebotMessages(instance, session, settings, remoteJid, messages, input, clientSideActions)
-parseListFormat(text: string)
-parseButtonFormat(text: string)
}
BaseChatbotService <|-- TypebotService
TypebotService o-- OpenaiService : uses for audio transcription
Class Diagram for WebhookController EnhancementsclassDiagram
class EventController
class WebhookController {
+set(instanceName, data)
+sendData(instanceName, event, webhookData)
#retryWebhookRequest(httpService, webhookData, origin, baseURL, serverUrl, maxRetries?, delaySeconds?)
-generateJwtToken(authToken: string): string
}
EventController <|-- WebhookController
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Esta PR corrige problemas de sintaxe no arquivo chatwoot-import-helper.ts, especificamente:
Essas correções eliminam o erro de build relacionado ao TypeScript e melhoram a robustez do código ao tratar exceções de forma adequada.
Summary by Sourcery
Refactor and extend core chatbot and event infrastructure, add new integrations, enhance media processing and message handling, and resolve critical build and runtime bugs
New Features:
Bug Fixes:
Enhancements:
Documentation: