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

rigobot-chat-bubble

v0.0.61

Published

> Note: To use this library you must have a [Rigobot acoount](https://ai.4geeks.com/)

Downloads

2,384

Readme

Rigobot Chat Bubble

Note: To use this library you must have a Rigobot acoount

Rigobot Chat Bubble is a customizable chat interface that can be easily integrated into any website. It allows users to interact with a chat agent and receive responses in real-time.

Getting Started

To use Rigobot Chat Bubble, you need to include the script in your HTML file and initialize the chat bubble with the required options.

Installation

Include the following script in your HTML file:

<script src="https://unpkg.com/[email protected]/dist/main.js"></script>

Usage

  1. Initialize the Chat Bubble

    You need to initialize the chat bubble with a token and optional settings. This can be done using the init method.

    window.rigo.init("YOUR_CHAT_AGENT_HASH", {
      completions: [
        {
          prompt: "What is the name of the Data Science main director?",
          answer: "The Data Science main director is Jenniffer Guzman",
          DOMTarget: "#chat-grow",
        },
      ],
      context: "The user is called: Lulú",
      introVideoUrl: "https://www.youtube.com/watch?v=sg_XoPrwjI0&t=3s",
    });
  2. Show the Chat Bubble

    To display the chat bubble, use the show method. You can specify various options such as showBubble, target, bubblePosition, collapsed, and welcomeMessage.

    window.rigo.show({
      showBubble: true,
      target: "#chat-grow",
      bubblePosition: {
        top: "10px",
        left: "10px",
      },
      collapsed: false,
      welcomeMessage: "I love punk",
      (user: { // This property is optional, use it only if the user is authenticated
          token: "some user token ",
          nickname: "user nickname"
        }),
    });
  3. Hide the Chat Bubble

    To hide the chat bubble, use the hide method.

    window.rigo.hide();
  4. Update options

    You can update the context of the chat bubble using the updateOptions method. This can be useful if you want to change the context dynamically based on user interactions.

    window.rigo.updateOptions({
      target: "#some-selecter", // The selector of the element you want the Rigobot bubble to move to
    });

Example

Here is a complete example of how to use Rigobot Chat Bubble in your HTML file:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Rigobot Bubble</title>
    <script src="https://unpkg.com/[email protected]/dist/main.js"></script>
  </head>
  <body style="height: 300vh">
    <h1 id="chat-grow">s</h1>
    <div style="position: absolute; top: 50%; right: 0" id="bottom-element">
      asdasd
    </div>
    <div style="position: absolute; top: 50%; right: 50%" class="centered-element">
      centered element
    </div>
    <div
      style="position: absolute; bottom: 0%; right: 50%"
      class="bottom-left-element"
    >
      bottom left element
    </div>
    
    <script>
      document.addEventListener("DOMContentLoaded", function () {
        if (window.rigo) {
          // window.rigo.init("248b53865d6743519ef55b4ec65772a7", {
          window.rigo.init("0839749d0baa4a51ac165d40b98f95f3", {
            loglevel: "debug",
            purposeSlug: "chayito",
            completions: [
              {
                prompt: "What is the name of the Data Science main director?",
                answer: "The Data Science main director is Jenniffer Guzman",
                DOMTarget: "#chat-grow",
              },
            ],

            introVideo: {
              url: "https://www.youtube.com/watch?v=sg_XoPrwjI0&t=3s",
            },
            context: "The user is called: Lulú",
            user: {
              token: "some user token ",
            },
          });

          window.rigo.show({
            // target: "#bottom-element",
            showBubble: false, // To keep the bubble hidden until you want to show it
            collapsed: false,
            highlight: true,
          });

          window.rigo.updateOptions({
            showBubble: true, // Show the bubble when you want to, you can call this in any time
            context: "Some new information about the context"
          })



          // window.rigo.hide();
        } else {
          console.error("window.rigo is not defined");
        }
      });
    </script>
  </body>
</html>

Options

{
  "loglevel": "info", // "info" or "debug" in lowercase, specifies the logging level (just available in the `init` method)
  "showBubble": true, // optional, it can be combined with "collapsed" to cofigure how rigobot displays on the website
  "target": "", // optional, the bubble or the conversation window (if showBubble=false) will tooltip from here.
  "collapsed": false, // optional, whether the chat bubble should be collapsed (closed) initially.
  "introVideo": {
    "url": "url of the video" // Video to show in the chat bubble
  }, // optional, The URL of the introductory video.
  "welcomeMessage": "I love punk", // optional, if null it will get the salutation message from the purpose
  "purposeSlug": "", // optional string, defaults to the first purpose in the organization,
  "completions": [], // optional array, additional context for the chat, completion object must have properties `prompt`, `answer`, and `DOMTarget`.
  "context": "" // optional string, additional context for the chat
}

Methods

  • init(token: string, options?: Options): Initializes the chat bubble with the given token and options.
  • show(Options): Displays the chat bubble with the specified options.
  • hide(): Hides the chat bubble.
  • updateOptions(Options): Updates the options without triggering a new render of the chat bubble.
  • `

License

This project is licensed under the MIT License.