UNPKG

react-chatbotify

Version:

A modern React library for creating flexible and extensible chatbots.

46 lines 2.1 kB
import { Dispatch, SetStateAction } from "react"; import { Message } from "../types/Message"; import { Settings } from "../types/Settings"; import { Styles } from "../types/Styles"; /** * Updates the messages array with a new message appended at the end and saves chat history if enabled. * * @param messages messages containing current conversation with the bot */ declare const saveChatHistory: (messages: Message[]) => Promise<void>; /** * Retrieves history messages. */ declare const getHistoryMessages: () => Message[]; /** * Sets history messages. * * @param messages chat history messages to set */ declare const setHistoryMessages: (messages: Message[]) => void; /** * Clears existing history messages. */ declare const clearHistoryMessages: () => void; /** * Sets the currently used history storage key. * * @param settings options provided to the bot */ declare const setHistoryStorageValues: (settings: Settings) => void; /** * Loads chat history into the chat window for user view. * * @param settings settings provided to the bot * @param styles styles provided to the bot * @param chatHistory chat history to show * @param setSyncedMessages sync ref and state setter for messages * @param syncedMessagesRef live ref of current messages array * @param chatBodyRef reference to the chat body * @param chatScrollHeight current chat scroll height * @param setIsLoadingChatHistory setter for whether chat history is loading * @param setHasChatHistoryLoaded setter for indicating if chat history is loaded */ declare const loadChatHistory: (settings: Settings, styles: Styles, chatHistory: Message[], setSyncedMessages: Dispatch<SetStateAction<Message[]>>, syncedMessagesRef: React.MutableRefObject<Message[]>, chatBodyRef: React.RefObject<HTMLDivElement | null>, chatScrollHeight: number, setIsLoadingChatHistory: Dispatch<boolean>, setHasChatHistoryLoaded: Dispatch<boolean>) => void; export { saveChatHistory, loadChatHistory, getHistoryMessages, setHistoryMessages, clearHistoryMessages, setHistoryStorageValues }; //# sourceMappingURL=ChatHistoryService.d.ts.map