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

@mystist/react-chatgpt

v0.0.96

Published

Embedding your chatgpt agent into your react application, option in tailwindcss, from development to release, all in this react-chatgpt project.

Downloads

103

Readme

react-chatgpt

Embedding your chatgpt agent into your react application, option in tailwindcss, from development to release, all in this react-chatgpt project.

Features

  • Component library development starter: You can simply use this project as a starter for developing modern react + tailwindcss npm libraries. The project uses tailwindcss and effectively isolates the styles of the library, allowing it to be seamlessly used in both react or react + tailwindcss projects.
  • Fancy and customizable UI: Elevate the appearance and experience of your agent by utilizing the tailwindcss framework, which can be easily customized to suit your preferences.
  • Universal chatgpt agent: With its versatile design, you can create agents for any purpose by align with your api implementation.
  • Keep context: Keep the full rounds of context.
  • Infinite conversation: Start new conversation automatically when reach rate limit.
  • Out of the box: Built in i18n support, built in disclaimer support, ready to use out of the box.
  • Voice interaction: Supports voice input and output, and voice also supports multiple languages.
  • Responsive: Optimized for various screen sizes and adapt automatically.
  • Chart support: Chart support with Mermaid.

Quick start

yarn add @mystist/react-chatgpt

For react project:

import '@mystist/react-chatgpt/dist/style.css'

import { ReactChatGPT } from '@mystist/react-chatgpt'

For nextjs project:

import '@mystist/react-chatgpt/dist/style.css'

import dynamic from 'next/dynamic'

export const ReactChatGPT = dynamic(() => import('@mystist/react-chatgpt').then((module) => module.ReactChatGPT as any), { ssr: false })

Render chat with self controlled component, you can controll the open/closed status by yourself

Sample: ./components/Agent/index.tsx

import '@mystist/react-chatgpt/dist/style.css'

import dynamic from 'next/dynamic'
import { useState } from 'react'

export const ReactChatGPT = dynamic(() => import('@mystist/react-chatgpt').then((module) => module.ReactChatGPT as any), { ssr: false })

const DefaultAvatar = () => (
  <span className="inline-block h-full w-full overflow-hidden rounded-full bg-gray-100">
    <svg className="h-full w-full text-gray-300" fill="currentColor" viewBox="0 0 24 24">
      <path d="M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z" />
    </svg>
  </span>
)

export default function Index() {
  const [status, setStatus] = useState('')

  const identifier = '<your identifier>'
  const lang = 'en'

  return (
    <>
      <button onClick={() => setStatus('open')}>
        <div className="relative h-16 w-16">
          <DefaultAvatar />
          <span className="absolute bottom-0 right-0 block h-3 w-3 rounded-full bg-green-400 ring-2 ring-white" />
        </div>
      </button>

      {/* @ts-ignore */}
      {identifier && <ReactChatGPT status={status} setStatus={setStatus} identifier={identifier} lang={lang} />}
    </>
  )
}

Start chat with avatar automatically


<ReactChatGPT mode="auto" identifier={identifier} lang={lang} />

Options

  • mode<''(default) | 'auto'>: The usage mode for react chat.
    • auto: mode will render the chat with avatar and controlled the open/closed status automatically
    • without mode, you can controll the status by your self.
  • status<'' | 'open'>: The React state represent the opening of the ReactChatGPT component.
  • setStatus: The React state set function controls the opening of the ReactChatGPT component.
  • identifier: To retrieve the specified data from the API endpoint with this identifier param.
  • lang: Specify the language, such as 'en' for English, 'zh' for Chinese, and 'ja' for Japanese.
  • overlayMode<'auto'(default) | 'modal' | 'slide-over'>: Specify the overlay mode. The default is 'auto', which will use 'modal' for large screens and 'slide-over' for smaller screens.

API dependencies

Checkout src/lib/requests/index.tsx for the api dependencies.

Be aware that the Configuration api is the basic api to have react-chatgpt up and running: api/configuration?identifier=<your identifier>&lang=<your lang> It should return a Configuration object specs here: src/lib/interfaces/index.tsx

Development

yarn
yarn dev

Release

yarn release