Skip to content

Commit 69b4f1a

Browse files
committed
feat(chatbot): implement base chatbot structure and enhance integration capabilities
- 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.
1 parent d3ee370 commit 69b4f1a

File tree

13 files changed

+2118
-3195
lines changed

13 files changed

+2118
-3195
lines changed

src/api/integrations/chatbot/base-chatbot.controller.ts

Lines changed: 921 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { TriggerOperator, TriggerType } from '@prisma/client';
2+
3+
/**
4+
* Base DTO for all chatbot integrations
5+
* Contains common properties shared by all chatbot types
6+
*/
7+
export class BaseChatbotDto {
8+
enabled?: boolean;
9+
description: string;
10+
expire?: number;
11+
keywordFinish?: string[];
12+
delayMessage?: number;
13+
unknownMessage?: string;
14+
listeningFromMe?: boolean;
15+
stopBotFromMe?: boolean;
16+
keepOpen?: boolean;
17+
debounceTime?: number;
18+
triggerType: TriggerType;
19+
triggerOperator?: TriggerOperator;
20+
triggerValue?: string;
21+
ignoreJids?: string[];
22+
splitMessages?: boolean;
23+
timePerChar?: number;
24+
}
25+
26+
/**
27+
* Base settings DTO for all chatbot integrations
28+
*/
29+
export class BaseChatbotSettingDto {
30+
expire?: number;
31+
keywordFinish?: string[];
32+
delayMessage?: number;
33+
unknownMessage?: string;
34+
listeningFromMe?: boolean;
35+
stopBotFromMe?: boolean;
36+
keepOpen?: boolean;
37+
debounceTime?: number;
38+
ignoreJids?: any;
39+
splitMessages?: boolean;
40+
timePerChar?: number;
41+
fallbackId?: string; // Unified fallback ID field for all integrations
42+
}

0 commit comments

Comments
 (0)