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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ai-assistant-chat-sneha105

v0.2.10

Published

A universal chat widget with markdown support that works in any frontend framework

Downloads

1,211

Readme

AI Assistant Chat Widget

A universal chat widget with markdown support that works seamlessly across React, Vue, Angular, and vanilla JavaScript applications.

Features

  • 🚀 Framework Agnostic - Works with React, Vue, Angular, and vanilla JS
  • 📝 Markdown Support - Rich text, tables, code blocks, math equations
  • 🎨 Customizable - Position, theme, title, and API endpoint
  • 📱 Responsive - Adapts to different screen sizes
  • Lightweight - Minimal dependencies
  • 🔧 Easy Integration - Multiple integration methods

Installation

Basic Installation

npm install ai-assistant-chat

For React with Full Markdown Support

npm install ai-assistant-chat react-markdown remark-gfm rehype-highlight rehype-raw remark-math rehype-katex katex highlight.js

For Vanilla JS

npm install ai-assistant-chat marked highlight.js

Usage

React

import ChatWidget from 'ai-assistant-chat';

function App() {
  return (
    <div>
      <h1>My App</h1>
      <ChatWidget />
    </div>
  );
}

Vue

<template>
  <div>
    <h1>My Vue App</h1>
  </div>
</template>

<script>
import { createChatWidget } from 'ai-assistant-chat/vanilla';

export default {
  mounted() {
    this.chatWidget = createChatWidget({
      position: 'bottom-right',
      title: 'Vue Assistant'
    });
  },
  beforeUnmount() {
    if (this.chatWidget) {
      this.chatWidget.destroy();
    }
  }
}
</script>

Angular

import { Component, OnInit, OnDestroy } from '@angular/core';
import { createChatWidget } from 'ai-assistant-chat/vanilla';

@Component({
  selector: 'app-root',
  template: '<h1>My Angular App</h1>'
})
export class AppComponent implements OnInit, OnDestroy {
  private chatWidget: any;

  ngOnInit() {
    this.chatWidget = createChatWidget({
      position: 'bottom-left',
      title: 'Angular Assistant'
    });
  }

  ngOnDestroy() {
    if (this.chatWidget) {
      this.chatWidget.destroy();
    }
  }
}

Vanilla JavaScript

<!DOCTYPE html>
<html>
<head>
    <title>My App</title>
</head>
<body>
    <h1>My Vanilla JS App</h1>
    
    <script src="https://unpkg.com/ai-assistant-chat/dist/chat-widget-vanilla.umd.js"></script>
    <script>
        const chatWidget = new ChatWidgetVanilla({
            position: 'top-right',
            title: 'Vanilla Assistant'
        });
    </script>
</body>
</html>

Web Component

<!DOCTYPE html>
<html>
<head>
    <title>My App</title>
</head>
<body>
    <h1>My App</h1>
    
    <chat-widget 
    api-url="https://your-api.com"
        position="bottom-right"
        title="Web Component Assistant"
        subtitle="Always Online">
    </chat-widget>
    
    <script src="https://unpkg.com/ai-assistant-chat/dist/chat-widget-vanilla.umd.js"></script>
</body>
</html>

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiUrl | string | 'http://0.0.0.0:8000' | Base API URL for chat requests (widget appends /chat/ or /history/) | | position | string | 'bottom-right' | Widget position (bottom-right, bottom-left, top-right, top-left) | | theme | string | 'light' | Theme (light, dark) | | title | string | 'AI Assistant' | Widget header title | | subtitle | string | 'Online' | Widget header subtitle |

API Methods

Vanilla JavaScript / Vue / Angular

const chatWidget = createChatWidget();

// Show the widget
chatWidget.show();

// Hide the widget
chatWidget.hide();

// Add a message programmatically
chatWidget.addMessage('Hello from code!', false);

// Clear all messages
chatWidget.clearMessages();

// Destroy the widget (clean up)
chatWidget.destroy();

React

The React component automatically handles lifecycle management.

Framework-Specific Notes

React

  • Uses React hooks and JSX
  • Automatically manages component lifecycle
  • Requires React 18+ and React DOM

Vue

  • Use createChatWidget() in mounted() lifecycle
  • Clean up with destroy() in beforeUnmount()
  • No React dependencies required

Angular

  • Use createChatWidget() in ngOnInit()
  • Clean up with destroy() in ngOnDestroy()
  • No React dependencies required

Vanilla JavaScript

  • Use new ChatWidgetVanilla() or createChatWidget()
  • Manually manage lifecycle
  • No framework dependencies

Building

# Build React version
npm run build:vite

# Build vanilla JavaScript version
npm run build:vanilla

# Build both versions
npm run build:all

Development

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build:all

License

MIT