JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 40
  • Score
    100M100P100Q61829F

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_tokens 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
Left Chat Right Chat

โœ… 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 and replicate 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!