0.0.51 • Published 8 months ago

@cloudtrain/chatbot-react v0.0.51

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

CloudTrain Chatbot for React

The CloudTrain Chatbot is a customizable React component that enables seamless chatbot integration into your React application.
Users must create an AI model on CloudTrain AI and generate an API key to use this component.


šŸš€ Features

  • AI chatbot React component.
  • Fully customizable chatbot suggestions.
  • Responsive and lightweight.

šŸ“– Getting Started

1ļøāƒ£ Installation

Install the CloudTrain Chatbot package using npm:

npm i @cloudtrain/chatbot-react

2ļøāƒ£ Usage

Import the CloudtrainChatbot component and use it in your React project:

import { CloudtrainChatbot } from "@cloudtrain/chatbot-react";

function App() {
  return (
    <div>
      <CloudtrainChatbot apiKey="YOUR_API_KEY_HERE" />
    </div>
  );
}

export default App;

Replace YOUR_API_KEY_HERE with the API key generated at CloudTrain AI.


3ļøāƒ£ Adding Chat Suggestions

You can pass chat suggestions as a prop:

<CloudtrainChatbot 
  apiKey="YOUR_API_KEY_HERE"
  chatSuggestions={["How can I help you?", "Tell me more about your issue.", "What can I assist you with today?"]} 
/>

4ļøāƒ£ Setting Theme

You can specify a theme using the theme prop. Available options are light, dark, or system:

<CloudtrainChatbot 
  apiKey="YOUR_API_KEY_HERE"
  theme="dark"
/>

If theme is set to system, it will adapt to the user's system preference.


5ļøāƒ£ Passing Meta Data

You can pass a custom meta object to the chatbot to provide additional context or metadata to the AI:

<CloudtrainChatbot 
  apiKey="YOUR_API_KEY_HERE"
  meta={{ name: "John" }}
/>

6ļøāƒ£ Customizing Colors

You can override the default color variables to customize the chatbot's appearance.

Add CSS rules in your app targeting :root or the cloudtrain-chatbot tag:

:root {
  --cloudtrain-foreground: 0, 100%, 50%;
}

cloudtrain-chatbot[data-theme="dark"] {
  --cloudtrain-foreground: 120, 100%, 50%;
}

List of Overridable CSS Variables

  • --cloudtrain-background
  • --cloudtrain-foreground
  • --cloudtrain-border
  • --cloudtrain-primary
  • --cloudtrain-primary-foreground
  • --cloudtrain-input
  • --cloudtrain-muted-foreground
  • --cloudtrain-ring
  • --cloudtrain-accent
  • --cloudtrain-accent-foreground
  • --cloudtrain-message-icon

šŸ“Œ API Reference

šŸ”¹ Props

PropTypeRequiredDescription
apiKeyStringāœ… YesThe API key generated on CloudTrain AI.
chatSuggestionsArrayāŒ NoAn array of strings used as chatbot prompts.
theme"light" | "dark" | "system" | undefinedāŒ NoSets the chatbot theme. Defaults to system preference if undefined.
metaObjectāŒ NoCustom metadata object passed to the AI model.

šŸ”‘ How to Generate API Key

  1. Go to CloudTrain AI.
  2. Create an AI model for your chatbot.
  3. Generate an API key for the model.
  4. Use the API key in the apiKey prop of the CloudtrainChatbot component.

šŸ“œ License

This project is licensed under the MIT License.


šŸ’” Need help? Contact support at CloudTrain AI. šŸš€

0.0.51

8 months ago

0.0.50

8 months ago

0.0.49

8 months ago

0.0.48

8 months ago

0.0.47

8 months ago

0.0.46

8 months ago

0.0.45

8 months ago

0.0.44

8 months ago

0.0.43

8 months ago

0.0.42

8 months ago

0.0.41

8 months ago

0.0.40

8 months ago

0.0.39

8 months ago

0.0.38

8 months ago

0.0.37

8 months ago

0.0.36

8 months ago

0.0.35

8 months ago

0.0.34

10 months ago

0.0.33

11 months ago

0.0.32

11 months ago

0.0.31

11 months ago

0.0.30

11 months ago

0.0.29

11 months ago

0.0.28

11 months ago

0.0.27

11 months ago

0.0.25

11 months ago

0.0.24

11 months ago

0.0.23

11 months ago

0.0.22

11 months ago

0.0.21

11 months ago

0.0.20

11 months ago

0.0.19

11 months ago

0.0.18

11 months ago

0.0.17

11 months ago

0.0.16

11 months ago

0.0.15

11 months ago

0.0.14

11 months ago

0.0.13

11 months ago

0.0.11

11 months ago

0.0.10

11 months ago

0.0.9

11 months ago

0.0.8

11 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago