UNPKG

chattr

Version:

A chatgpt chatbot component library for nextjs.

220 lines (186 loc) 7.61 kB
import React$1 from 'react'; type ChattrAssistantMessage$1 = { key?: string; content?: string; chattrBotName?: string; }; declare function ChattrAssistantMessage$1({ key, content, chattrBotName, }: ChattrAssistantMessage$1): React$1.JSX.Element; declare function ChattrCloseIcon$1(): React$1.JSX.Element; declare function ChattrContainer$1({ children, }: { children: React$1.ReactNode; }): React$1.JSX.Element; type ChattrMessageProps = { role: 'user' | 'assistant'; key?: string; content?: string; ui?: string; data?: { temperature: string; celcius: string; location: string; description: string; humidity: string; wind: string; clouds: string; state: string; url: string; }; }; type ChattrFormProps = { setMessage: React.Dispatch<React.SetStateAction<string>>; sendMessage: (event: React.MouseEvent | React.KeyboardEvent | React.FormEvent) => void; message: string; loading: boolean; }; declare function ChattrFeed$1({ messages, userName, chattrBotName, loading, }: { messages: ChattrMessageProps[]; userName?: string; chattrBotName?: string; loading?: boolean; }): React$1.JSX.Element; declare const _default$4: React$1.MemoExoticComponent<typeof ChattrFeed$1>; declare function ChattrForm$1({ setMessage, sendMessage, message, loading, }: ChattrFormProps): React$1.JSX.Element; declare function ChattrHeader$1({ toggle, chattrBotName, }: { toggle: () => void; chattrBotName?: string; }): React$1.JSX.Element; declare const _default$3: React$1.MemoExoticComponent<typeof ChattrHeader$1>; declare function ChattrMessages$1({ message: { content, role, key }, userName, chattrBotName, }: { message: ChattrMessageProps; userName?: string; chattrBotName?: string; }): React$1.JSX.Element; declare const _default$2: React$1.MemoExoticComponent<typeof ChattrMessages$1>; type ChattrUserMessage$1 = { key?: string; content?: string; userName?: string; }; declare function ChattrUserMessage$1({ key, content, userName, }: ChattrUserMessage$1): React$1.JSX.Element; /** * Chattrbot - A pre made chatbot solution with light/dark mode tailwind css classes. Uses basic chat functionality with chatgpt models. * @returns The entire Default Chattrbot component. */ declare function Chattrbot$1(): React$1.JSX.Element; declare namespace index_d$1 { export { ChattrAssistantMessage$1 as ChattrAssistantMessage, ChattrCloseIcon$1 as ChattrCloseIcon, ChattrContainer$1 as ChattrContainer, _default$4 as ChattrFeed, ChattrForm$1 as ChattrForm, _default$3 as ChattrHeader, _default$2 as ChattrMessages, ChattrUserMessage$1 as ChattrUserMessage, Chattrbot$1 as Chattrbot }; } declare function ChattrAssistantImage({ key, data, }: { key?: string; data?: { description: string; url: string; }; }): React$1.JSX.Element; declare function ChattrAssistantMessage({ key, content, }: { key?: string; content?: string; }): React$1.JSX.Element; declare function ChattrAssistantVideo({ key, data, }: { key?: string; data?: { description: string; url: string; }; }): React$1.JSX.Element; declare function ChattrAssistantWeather({ key, data, }: { key?: string; data?: { temperature: string; celcius: string; location: string; description: string; humidity: string; wind: string; clouds: string; state: string; url: string; }; }): React$1.JSX.Element; declare function ChattrCloseIcon(): React$1.JSX.Element; declare function ChattrContainer({ children, }: { children: React$1.ReactNode; }): React$1.JSX.Element; declare function ChattrFeed({ messages, loading, }: { messages: ChattrMessageProps[]; loading: boolean; }): React$1.JSX.Element; declare const _default$1: React$1.MemoExoticComponent<typeof ChattrFeed>; declare function ChattrForm({ setMessage, sendMessage, message, loading, }: ChattrFormProps): React$1.JSX.Element; declare function ChattrHeader({ chattrBotName, role, toggle, }: { chattrBotName: string; role: string; toggle: () => void; }): React$1.JSX.Element; declare function ChattrLoader(): React$1.JSX.Element; declare function ChattrMessages({ message: { content, role, key, ui, data }, }: { message: ChattrMessageProps; }): React$1.JSX.Element; declare const _default: React$1.MemoExoticComponent<typeof ChattrMessages>; declare function ChattrUserMessage({ key, content, }: { key?: string; content?: string; }): React$1.JSX.Element; /** * Chattrbot - A pre made chatbot solution with light/dark mode tailwind css classes. Uses function calling features. * @returns The entire Minimalist Chattrbot component. */ declare function Chattrbot(): React$1.JSX.Element; declare const index_d_ChattrAssistantImage: typeof ChattrAssistantImage; declare const index_d_ChattrAssistantMessage: typeof ChattrAssistantMessage; declare const index_d_ChattrAssistantVideo: typeof ChattrAssistantVideo; declare const index_d_ChattrAssistantWeather: typeof ChattrAssistantWeather; declare const index_d_ChattrCloseIcon: typeof ChattrCloseIcon; declare const index_d_ChattrContainer: typeof ChattrContainer; declare const index_d_ChattrForm: typeof ChattrForm; declare const index_d_ChattrHeader: typeof ChattrHeader; declare const index_d_ChattrLoader: typeof ChattrLoader; declare const index_d_ChattrUserMessage: typeof ChattrUserMessage; declare const index_d_Chattrbot: typeof Chattrbot; declare namespace index_d { export { index_d_ChattrAssistantImage as ChattrAssistantImage, index_d_ChattrAssistantMessage as ChattrAssistantMessage, index_d_ChattrAssistantVideo as ChattrAssistantVideo, index_d_ChattrAssistantWeather as ChattrAssistantWeather, index_d_ChattrCloseIcon as ChattrCloseIcon, index_d_ChattrContainer as ChattrContainer, _default$1 as ChattrFeed, index_d_ChattrForm as ChattrForm, index_d_ChattrHeader as ChattrHeader, index_d_ChattrLoader as ChattrLoader, _default as ChattrMessages, index_d_ChattrUserMessage as ChattrUserMessage, index_d_Chattrbot as Chattrbot }; } declare function ChattrOpenButton({ toggle }: { toggle: () => void; }): React$1.JSX.Element; declare function ChattrOpenIcon(): React$1.JSX.Element; declare function create_image(description: string): Promise<{ description: string; url: string; }>; declare function create_video(description: string): Promise<{ description: string; url: object; }>; declare function get_current_weather(zipcode: string, state: string): Promise<{ temperature: string; celcius: string; location: string; url: string; description: string; humidity: string; wind: string; clouds: string; state: string; }>; /** * Manages the open and closed states of the chattr UI. * * @returns An object containing the current state and a function to toggle it. * * @default isOpen false */ declare function useChattr(): { isOpen: boolean; toggle: () => void; }; /** * Manages automatic scrolling of new content to the bottom of the ChattrFeed. * * @param messages An array of ChattrMessage objects. * * @returns The reference object used to manipulate the referenced DOM element (the `div`). * */ declare function useScroll(messages: ChattrMessageProps[]): React$1.RefObject<HTMLDivElement>; export { type ChattrFormProps, type ChattrMessageProps, ChattrOpenButton, ChattrOpenIcon, index_d$1 as Default, index_d as Minimalist, create_image, create_video, get_current_weather, useChattr, useScroll };