npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

chatbot-widget-ui

v2.1.1

Published

React js Chatbot Widget UI library

Downloads

261

Readme

Overview

Chatbot Demo

GitHub license npm version PRs Welcome

Authors: Hassen Amri, Raed Lazreg, Taha Berguiga

NPM Package Link: chatbot-widget-ui

Package Github Repository Link: chatbot-widget-ui

chatbot-widget-ui is a library for creating a React.js chatbot widget UI, built with TypeScript. It offers extensive customization features for building interactive chatbot experiences and supports integration with any LLM API to generate dynamic responses.

Features:

  • Implemented using React.js and TypeScript for robustness and type safety.
  • Provides a customizable user interface for integrating chatbot functionality into web applications.
  • Offers various configuration options to tailor the chatbot widget's appearance and behavior.
  • Supports integration with any LLM API for generating dynamic responses.

Usage

The library enables easy integration of chatbot features into React.js applications, enhancing user interaction and experience.

  1. Install the latest version:
npm install chatbot-widget-ui@latest
  1. Import the library:
import { ChatBotWidget } from "chatbot-widget-ui";
  1. Use the ChatBotWidget component:
<ChatBotWidget
  callApi={customApiCall}
  primaryColor="#3498db"
  inputMsgPlaceholder="Type your message..."
  chatbotName="Customer Support"
  isTypingMessage="Typing..."
  IncommingErrMsg="Oops! Something went wrong. Try again."
  handleNewMessage={setMessages}
  chatIcon={<div>O</div>}
/>

Usage Example

import React from "react";
import { ChatBotWidget } from "chatbot-widget-ui";

const App = () => {
  // save all messages conversation
  // Example: [{'type': 'user', 'text': 'hello'}, {'type': 'bot', 'text': 'Hello, how can i assist you today!'}, ...]
  const [messages, setMessages] = useState<string[]>([]);

  const customApiCall = async (message: string): Promise<string> => {
    const response = await fetch("https://example.com/api", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ userMessage: message }),
    });
    const data = await response.json();
    return data.content;
  };

  return (
    <div>
      <ChatBotWidget
        callApi={customApiCall}
        primaryColor="#3498db"
        inputMsgPlaceholder="Type your message..."
        chatbotName="Customer Support"
        isTypingMessage="Typing..."
        IncommingErrMsg="Oops! Something went wrong. Try again."
        handleNewMessage={setMessages}
        chatIcon={<div>O</div>}
      />
    </div>
  );
};

export default App;

Chatbot Component Props

| Prop Name | Type | Default Value | Description | | --------------------- | ---------- | ------------------------------------------------- | ----------------------------------------------------------------------------------- | | callApi | function | N/A | Sends an API request to retrieve text completion. | | chatbotName | string | "Chatbot" | The name/title of the chatbot displayed in the header. | | isTypingMessage | string | "Typing..." | The message displayed when the chatbot is typing a response. | | IncommingErrMsg | string | "Oops! Something went wrong. Please try again." | The error message displayed when an API request fails. | | primaryColor | string | "#eb4034" | The primary color used for styling elements like headers, buttons, and backgrounds. | | inputMsgPlaceholder | string | "Send a Message" | The placeholder text shown in the chat input textarea. | | chatIcon | any | ChatIcon() (ReactElement) | The icon displayed in the chatbot toggler button. | | handleNewMessage | function | N/A | Placeholder for a function to process new messages. |