Socket
Book a DemoInstallSign in
Socket

@chrisabdo/rag-chatbot-widget

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chrisabdo/rag-chatbot-widget

A simple RAG chatbot widget for web applications

0.1.0
latest
npmnpm
Version published
Weekly downloads
1
Maintainers
0
Weekly downloads
 
Created
Source

RAG Chatbot Widget

A simple, customizable React component for adding a Retrieval-Augmented Generation (RAG) chatbot widget to your web application.

Features

  • 🚀 Easy to integrate into any React application
  • 💬 Fixed position chat button that opens a modal dialog
  • 🌗 Light and dark mode support
  • 🎨 Customizable appearance and positioning
  • 🔌 Connect to any RAG backend API

Installation

npm install rag-chatbot-widget
# or
yarn add rag-chatbot-widget
# or
pnpm add rag-chatbot-widget

Quick Start

import { ChatbotWidget } from 'rag-chatbot-widget';
import 'rag-chatbot-widget/styles.css'; // Import the styles

function App() {
  return (
    <div className="app">
      <h1>My Application</h1>
      
      {/* Add the chatbot widget */}
      <ChatbotWidget 
        apiUrl="/api/chat" 
        title="Knowledge Assistant"
      />
    </div>
  );
}

Configuration

The ChatbotWidget component accepts the following props:

Widget Configuration

PropTypeDefaultDescription
titlestring'RAG Chatbot'Title for the chatbot modal
buttonIconReactNode'💬'Button icon content (emoji, text, or SVG)
buttonAriaLabelstring'Open chatbot'Button aria-label for accessibility
zIndexnumber9999CSS z-index for the widget
buttonPositionstring'bottom-right'Button position ('bottom-right', 'bottom-left', 'top-right', 'top-left')
buttonClassNamestring''Custom class for the button
themestring'auto'Widget theme ('light', 'dark', 'auto')

Chat Configuration

PropTypeDefaultDescription
apiUrlstring'/api/chat'API endpoint for the chatbot
apiHeadersobject{ 'Content-Type': 'application/json' }Headers for API requests
placeholderstring'Ask a question...'Placeholder text for the input field
initialMessagesarray[]Initial messages to display
classNamestring''Custom class for the chat component

API Integration

Your backend API should accept POST requests with the following structure:

{
  "query": "User's question here"
}

And it should respond with:

{
  "response": "Assistant's response here"
}

Standalone Chat Component

If you want to use the chat interface without the floating button and modal, you can use the Chat component directly:

import { Chat } from 'rag-chatbot-widget';
import 'rag-chatbot-widget/styles.css';

function MyCustomChatInterface() {
  return (
    <div className="chat-container" style={{ height: '500px' }}>
      <Chat 
        apiUrl="/api/chat"
        placeholder="Ask me anything..."
      />
    </div>
  );
}

License

MIT

Keywords

rag

FAQs

Package last updated on 20 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.