react-chat-ai-widget
Version:
Enhance user experience with a smart widget that combines AI assistants and live chat. Automate support, stay available 24/7, and boost customer engagement effortlessly.
88 lines (71 loc) • 2.27 kB
TypeScript
import { default as default_2 } from 'react';
import { JSX } from 'react/jsx-runtime';
export declare const ChatWidget: ({ direction, children, Loader, ...props }: IContextProps) => JSX.Element;
declare type ConfigType = IReplicateConfigProps | IHuggingFaceConfig;
declare type ContextOptionals = Partial<{
huggingface: string;
replicate: string;
onClose: () => void;
direction: Direction;
title: string;
config: ConfigType;
children: default_2.ReactNode;
Loader: default_2.ReactNode;
initialQuestions: InitialQuestions;
}>;
declare interface DataProps {
questions: Question[];
useCase?: useCase;
metadata?: {
version: string;
lastUpdated: Date;
source: string;
};
}
declare type Direction = "right" | "left";
declare type IContext = StylesProps & ContextOptionals & {
data: DataProps;
};
declare type IContextProps = Omit<IContext, "onClose">;
declare interface IHuggingFaceConfig {
model: string;
temperature: number;
max_tokens: number;
timeout: number;
frequency_penalty: number;
}
declare type InitialQuestions = Array<{
question: string;
}>;
declare type IReplicateConfigProps = Omit<IReplicateServiceConfig, "apiKey">;
declare interface IReplicateServiceConfig {
readonly model: string;
readonly top_k: number;
readonly top_p: number;
readonly temperature: number;
readonly max_new_tokens: number;
readonly min_new_tokens: number;
readonly repetition_penalty: number;
readonly max_tokens: number;
readonly apiKey: string;
}
declare interface Question {
question: string;
answer: string;
category?: string;
confidence?: number;
}
declare type StylesProps = Partial<StylesPropsP>;
declare interface StylesPropsP {
formStyles: {
inputStyles?: React.CSSProperties;
buttonStyles?: React.CSSProperties;
formStyles?: React.CSSProperties;
};
chatClassName: string;
chatStyles: React.CSSProperties;
headerClassName: string;
headerStyles: React.CSSProperties;
}
declare type useCase = "customer-support" | "documentation" | "qa-bot" | "strict-compliance";
export { }