Package Exports
- react-chat-ai-widget
- react-chat-ai-widget/dist/style.css
Readme
๐ค ChatWidget
A ready-to-use React component that lets you integrate an intelligent chatbot powered by Hugging Face or Replicate easily and securely.
No complex setup or model configuration needed. Just add your access_token
from Hugging Face or Replicate, and you're done.
๐ Installation
npm install react-chat-ai-widget
๐ง What It Does
This component lets you deploy a chatbot in seconds. Perfect for websites, educational apps, support assistants, and more.
โ
No backend required
โ
100% token security via specialized proxy
โ
Minimal configuration
โ
Compatible with Hugging Face or Replicate (use one, not both)
โจ Basic Usage
import { ChatWidget } from 'react-chat-ai-widget';
<ChatWidget
data={{
useCase: "customer-support" // customer-support per default,
questions: [
{
question: "What is the open hours of the InsightFlow?",
answer:
"The open hours of the InsightFlow are Monday to Friday from 10am to 4pm",
category: "general",
confidence: 0.98
},
{
question: "Who wrote Don Quixote?",
answer: "Miguel de Cervantes",
category: "literature",
confidence: 0.92
}
]
}}
huggingface="YOUR_HUGGINGFACE_TOKEN" // or use replicate
// replicate="YOUR_REPLICATE_TOKEN"
direction="left" // left default value
/>
๐งฉ Component Props
Prop | Type | Required | Description |
---|---|---|---|
data |
object | โ | Contains questions and answers the bot can use. |
huggingface |
string | โ ๏ธ | Hugging Face token. Do not use together with replicate . |
replicate |
string | โ ๏ธ | Replicate token. Do not use together with huggingface . |
direction |
string | โ | Chat appearance side (left , right ). Default: right . |
๐ data
Format
You can optionally define a useCase
to control the behavior of the AI depending on your application context.
Available useCase
values:
"customer-support"
: Friendly and helpful tone for assisting users."documentation"
: Answers based on structured technical information."qa-bot"
: Default question-answer behavior with flexible logic."strict-compliance"
: Very controlled and policy-aware responses.
{
useCase: "qa-bot", // optional
questions: [
{
question: "Your question?",
answer: "The bot's answer.",
category: "General category",
confidence: 0.85 // range 0 to 1
},
// add as many as you need
]
}
๐ Security
Your tokens are fully protected:
- โ
Hugging Face or Replicate
access_token
s are never exposed directly. - โ All requests are processed through a secure, specialized proxy.
- โ All communication is encrypted and handled safely.
๐ผ๏ธ Preview Images
Here are a few UI previews of the chatbot:
Chat aligned left | Chat aligned right |
---|---|
![]() |
![]() |
โ Features
- ๐งฉ Plug-and-play: integrate in seconds
- ๐ฏ Fully customizable with your own Q&A
- ๐ Perfect for smart FAQs or help assistants
- โ๏ธ Works with top AI providers
โ ๏ธ Notes
- Do not use both
huggingface
andreplicate
props at the same time. - Make sure to use a valid token from your Hugging Face or Replicate account.
- Use the
direction
prop to set chat alignment.
๐ง Upcoming Features
Hereโs whatโs coming soon to make your chatbot even more flexible and powerful:
๐ Customizable Chat Title
๐ง Add a title
prop to personalize the header text of your chat window.
Example: โAI Supportโ, โAsk me anythingโ, โVirtual Assistantโ
๐จ Style Overrides
๐งฉ Introduce a styles
prop to allow full UI customization.
Define your own fonts, borders, paddings, colors, and more to match your brand.
๐ Background Color
๐ผ Add a backgroundColor
prop to easily change the chat containerโs background.
From dark mode to pastel themesโmake it your own!