whatsapp-claude-gpt
Version:
WhatsApp-Claude-GPT is a WhatsApp chatbot that supports multiple AI providers for chat, optional image generation/editing, and voice (speech-to-text and text-to-speech). It’s built for natural, contextual conversations and can now also handle reminders an
61 lines (53 loc) • 1.4 kB
text/typescript
import type { ChatConfiguration } from '../config/chat-configurations';
export interface AIService<TMessage = any, TTools = any> {
sendMessage(messages: TMessage[], systemPrompt: string, chatConfig: ChatConfiguration, tools: TTools, toolContext?: ToolExecutionContext): Promise<string>;
addMessageToCache(item: TMessage, chatId: string): void;
deleteChatCache(chatId: string): void;
hasChatCache(chatId: string): boolean;
}
export interface AiMessage {
role: AIRole;
content: Array<AIContent>;
name?: string;
}
export enum AIRole {
USER='user',
ASSISTANT='assistant',
SYSTEM='system'
}
export interface AIContent {
msg_id?: string;
value?: string;
type: 'text' | 'image' | 'ASR' | 'file';
mimetype?: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | string;
filename?: string,
author_id: string,
dateString: string;
}
export enum AIProvider {
OPENAI='OPENAI',
CLAUDE='CLAUDE',
QWEN='QWEN',
DEEPSEEK='DEEPSEEK',
DEEPINFRA='DEEPINFRA',
ELEVENLABS='ELEVENLABS',
CUSTOM='CUSTOM'
}
export interface AIAnswer {
message: string;
type: 'text' | 'audio';
author: string;
emojiReact?: string;
}
export interface ToolExecutionContext {
chatId: string;
chatName: string;
messageId: string;
authorId: string;
isGroup: boolean;
imageMessageIds: string[];
}
export interface OperationResult {
success: boolean;
result: any;
}