import { WhatsAppBot, Message } from "@green-api/whatsapp-chatbot-js-v2"; import OpenAI from "openai"; import { GPTBotConfig, GPTSessionData, OpenAIModel } from "./types"; import { MessageHandler } from "./handlers/message-handlers"; /** * WhatsApp bot with GPT integration */ export declare class WhatsappGptBot extends WhatsAppBot { private readonly openai; private readonly maxHistoryLength; readonly systemMessage: string; private readonly model; private readonly temperature; private readonly errorMessage; private readonly middleware; private readonly messageHandlers; /** * Creates a new GPT WhatsApp bot instance */ constructor(config: GPTBotConfig); /** * Processes a message through the GPT model without using internal state management. * Handles message preprocessing, GPT model interaction, and response processing. * * @param message - The message to process * @param sessionData - Current session data containing message history and metadata. * Defaults to empty messages array and current timestamp. * @returns Object containing the processed response and updated session data * * @example * ```typescript * const { response, updatedData } = await gptBot.processMessage(message, { * messages: [{ role: "system", content: "You are a helpful assistant" }], * lastActivity: Date.now() * }); * await bot.sendText(message.chatId, response); * ``` */ processMessage(message: Message, sessionData?: GPTSessionData): Promise<{ response: string; updatedData: GPTSessionData; }>; /** * Add middleware to process messages before sending to the model */ addMessageMiddleware(middleware: any): this; /** * Add middleware to process responses before sending to the user */ addResponseMiddleware(middleware: any): this; /** * Register a custom message handler */ registerMessageHandler(handler: any, index?: number): this; /** * Get the OpenAI client instance */ getOpenAI(): OpenAI; /** * Get the current model being used */ getModel(): OpenAIModel; /** * Check if the current model supports image processing */ supportsImages(): boolean; /** * Replace a message handler with a new implementation * @param handlerType The handler class to replace * @param newHandler The new handler implementation * @returns true if replacement succeeded, false otherwise */ replaceHandler(handlerType: new (...args: any[]) => MessageHandler, newHandler: MessageHandler): boolean; /** * Process a message and prepare it for the model */ private processMessageContent; /** * Creates the main chat state for handling conversations */ private createChatState; }