refactor(chatbot): unify keywordFinish type and enhance session handling

- 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.
This commit is contained in:
Davidson Gomes
2025-05-21 17:02:24 -03:00
parent d673c83a93
commit f9567fbeaa
17 changed files with 819 additions and 4139 deletions

View File

@@ -31,7 +31,7 @@ export interface BaseBotData {
enabled?: boolean;
description: string;
expire?: number;
keywordFinish?: string[];
keywordFinish?: string;
delayMessage?: number;
unknownMessage?: string;
listeningFromMe?: boolean;
@@ -792,7 +792,7 @@ export abstract class BaseChatbotController<BotType = any, BotData extends BaseC
const content = getConversationMessage(msg);
// Get integration type
const integrationType = this.getIntegrationType();
// const integrationType = this.getIntegrationType();
// Find a bot for this message
let findBot: any = await this.findBotTrigger(this.botRepository, content, instance, session);