mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-18 21:16:29 -06:00

- Introduced a base structure for chatbot integrations, including BaseChatbotController and BaseChatbotService. - Added common DTOs for chatbot settings and data to streamline integration processes. - Updated existing chatbot controllers (Dify, Evoai, N8n) to extend from the new base classes, improving code reusability and maintainability. - Enhanced media message handling across integrations, including audio transcription capabilities using OpenAI's Whisper API. - Refactored service methods to accommodate new message structures and improve error handling.
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { TriggerOperator, TriggerType } from '@prisma/client';
|
|
|
|
/**
|
|
* Base DTO for all chatbot integrations
|
|
* Contains common properties shared by all chatbot types
|
|
*/
|
|
export class BaseChatbotDto {
|
|
enabled?: boolean;
|
|
description: string;
|
|
expire?: number;
|
|
keywordFinish?: string[];
|
|
delayMessage?: number;
|
|
unknownMessage?: string;
|
|
listeningFromMe?: boolean;
|
|
stopBotFromMe?: boolean;
|
|
keepOpen?: boolean;
|
|
debounceTime?: number;
|
|
triggerType: TriggerType;
|
|
triggerOperator?: TriggerOperator;
|
|
triggerValue?: string;
|
|
ignoreJids?: string[];
|
|
splitMessages?: boolean;
|
|
timePerChar?: number;
|
|
}
|
|
|
|
/**
|
|
* Base settings DTO for all chatbot integrations
|
|
*/
|
|
export class BaseChatbotSettingDto {
|
|
expire?: number;
|
|
keywordFinish?: string[];
|
|
delayMessage?: number;
|
|
unknownMessage?: string;
|
|
listeningFromMe?: boolean;
|
|
stopBotFromMe?: boolean;
|
|
keepOpen?: boolean;
|
|
debounceTime?: number;
|
|
ignoreJids?: any;
|
|
splitMessages?: boolean;
|
|
timePerChar?: number;
|
|
fallbackId?: string; // Unified fallback ID field for all integrations
|
|
}
|