react-ai-faq-chat
Version:
A smart AI-powered FAQ chatbot
147 lines (98 loc) β’ 3.33 kB
Markdown
# react-ai-faq-chat
> π Turn your documentation into a smart AI-powered FAQ chatbot in **minutes** β no backend, no APIs, 100% free.
## πΉ Why Use This Package?
Imagine your users opening your Help Center and asking questions like:
> βHow do I reset my password?β
> βWhere can I find the latest API docs?β
β¦and **instantly getting answers** from your own PDFs, Word docs, or Excel sheets β **without building complex AI systems or paying for APIs**.
`react-ai-faq-chat` does all the heavy lifting for you:
- Scans your **documentation files**
- Indexes them for fast answers
- Uses a **free, local AI model (Mistral-7B)** to reply intelligently
- Works **out-of-the-box in React and Next.js**
All in one tiny package. π‘
## πΉ Key Features
- β
**Supports PDF, Word (.docx), and Excel (.xlsx)**
- β
**Ephemeral chat** β conversation exists while the page is open
- β
**No database required**
- β
**No API keys, 100% free**
- β
**React + Next.js compatible**
- β
**Minimal config**: just point to your docs folder
- β
**Provides hook + ready-to-use ChatBot component**
## πΉ Installation
```bash
npm install react-ai-faq-chat
```
or
```bash
yarn add react-ai-faq-chat
```
## πΉ Usage
> Simply point `docsFolder` to the folder containing your PDF, Word, or Excel documentation. Thatβs it.
### Using the Hook
```tsx
import { useAIFAQChat } from "react-ai-faq-chat";
export default function CustomChat() {
const { messages, sendMessage, loading } = useAIFAQChat({ docsFolder: "./public/docs" });
return (
<div>
{messages.map((msg, idx) => (
<p key={idx} style={{ textAlign: msg.user ? "right" : "left" }}>{msg.text}</p>
))}
<input
placeholder="Ask me anything..."
onKeyDown={async (e) => {
if (e.key === "Enter") await sendMessage((e.target as HTMLInputElement).value);
}}
/>
{loading && <p>Loading...</p>}
</div>
);
}
```
> Perfect if you want to build a **custom UI** for your chatbot.
## πΉ How It Works (Simplified)
1. The package **reads all your docs** (PDF, Word, Excel)
2. **Splits them into small chunks** for AI understanding
3. Indexes them in a **fast local vector database** (FAISS)
4. Uses **Mistral-7B** AI (completely local, free) to answer questions
5. Returns answers in **real-time** to your React app
All this happens **behind the scenes**, no AI or backend setup required.
## πΉ Who Should Use This
- Product teams that want **instant FAQ chatbots**
- Customer support portals
- Developers who want **zero-cost AI integration**
- Anyone who has **documentation in PDF, Word, or Excel**
## πΉ Why It's Different
| Feature | react-ai-faq-chat | Other Solutions |
|---------|-----------------|----------------|
| Local AI (free) | β
| β |
| Works without backend | β
| β |
| Supports multiple doc types | β
| β |
| Easy React integration | β
| β |
| Ephemeral chat | β
| β |
## πΉ Minimal Config
All you need is:
```ts
{
docsFolder: "./path-to-your-docs"
}
```
> No API keys, no setup, no fuss.
## πΉ License
MIT Β© 2025
## πΉ Ready to Try?
```bash
npm install react-ai-faq-chat
```
Then drop it in your React/Next.js page and watch your docs come alive! π