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

llmasaservice-ui

v0.4.5

Published

Prebuilt UI components for LLMAsAService.io

Downloads

973

Readme

Prebuilt UI chat panel for LLM as a Service

LLMAsAService.io is a platform to accelerate and securely develop LLM features in your applications and websites.

This library offers a pre-built panel for incorporating chat GPT style features in react/nextjs applications.

Features

  • Multi-turn style chat interface
  • Open with an initial prompt (for example, after a click on a Summarize button in your application, set the initialPrompt to "Summarize the following text ..." and the panel will automatically show the summary)
  • Light and dark theme
  • Abort functionality
  • Markdown response display
  • Sizable vertically and horizontally to suit your app. use 100vh or 100vw for the height and width to full size the panel in that orientation.

What is LLM as a Service: https://llmasaservice.io

Register for a LLM as a Service account and get your unique project id from the integration page https://app.llmasaservice.io/integration

Dark mode example:

Dark Mode

Light mode example:

Light Mode

System instructios example:

Brand and personality

see documentation more examples: https://predictabilityatscale.github.io/llmasaservice-ui/?path=/docs/chatpanel--docs

Installation

To install the library, use npm or yarn:

# Using npm
npm install llmasaservice-ui

# Using yarn
yarn add llmasaservice-ui

Usage

In a React application

  1. Import the ChatPanel component
import React from 'react';
import { ChatPanel } from 'llmasaservice-ui';
import "../node_modules/llmasaservice-ui/dist/index.css"; // default styles for light and dark, or replace with your own

const App = () => {
  return (
    <div>
      <h1>My Chat Application</h1>
      <ChatPanel 
        project_id="[[get this from the LLMAsAService control panel]]"
        initialPrompt="Give a nice welcome message"
      />
    </div>
  );
};

export default App;
  1. Run your application
npm start

In a Next.js application

  1. Create a new page in pages/chat.js and add the following code
import React from 'react';
import { ChatPanel } from 'llmasaservice-ui';
import "../../node_modules/llmasaservice-ui/dist/index.css"; // default styles for light and dark, or replace with your own

const ChatPage = () => {
  return (
    <div>
      <h1>Chat Page</h1>
      <ChatPanel 
       project_id="[[your project_id from the llmasaservice control panel]]"
        title="Chat with us"
        initialPrompt="Write a short three sentence background on the city called: Seattle"
        />
    </div>
  );
};

export default ChatPage;
  1. Run Your Next.js Application:
npm run dev

Tailwind CSS support

If you use tailwind for CSS styling do these additional steps for proper markdown formatting -

a) install the Typography:

npm install -D @tailwindcss/typography 

b) add the plugin to your tailwind.config.js file:

module.exports = {
  theme: {
    // ...
  },
  plugins: [
    require('@tailwindcss/typography'),
    // ...
  ],
}

c) use prose as the class for the markdownStyle. This example is for dark mode

 <ChatPanel
        project_id="[[your project_id from the llmasaservice control panel]]"
        title="Chat with us"
        initialPrompt="Write a short three sentence background on the city called: Seattle"
        theme="dark"
        markdownClass="prose prose-sm !max-w-none dark:prose-invert"
      />

Customization

You can customize the chat panel by passing props to the ChatPanel component. Refer to the library documentation for more details on available props and customization options.

See our storybook documentation showing how to theme, size and use the variaous features in this component:

https://predictabilityatscale.github.io/llmasaservice-ui/?path=/docs/chatpanel--docs

License

This project is licensed under the MIT License.