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 🙏

© 2026 – Pkg Stats / Ryan Hefner

html-ai-chat-widget

v1.0.0

Published

Drop-in AI chat widget that answers from specified HTML pages using fuzzy keyword matching.

Readme

HTML AI Chat Widget

A lightweight, plug-and-play JavaScript widget that adds a floating AI chat to any HTML page. It answers questions using only the content from specified local HTML files—no external APIs required.

✨ Features

  • 🔍 Client-side fuzzy search (no server, no OpenAI key needed)
  • 📄 Reads and indexes any list of HTML pages
  • 💬 Friendly floating chat UI
  • ⚙️ Configurable via one setup() call
  • 📦 Works via script tag or NPM + CDN
  • 📊 Optional GoatCounter analytics support (free, privacy-friendly)

🔧 Quick Start

📦 Option 1: Script Tag (CDN)

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chat-widget.min.js"></script>
<script>
  HtmlAiChatWidget.setup({
    pages: ["/resume.html"],
    title: "Ask about this page",
    subtitle: "AI Assistant",
    analytics: true // enables optional GoatCounter ping
  });
</script>

🛠 Option 2: NPM

npm install html-ai-chat-widget
import { HtmlAiChatWidget } from 'html-ai-chat-widget';
HtmlAiChatWidget.setup({ pages: ["/about.html"], analytics: true });

⚙️ Configuration Options

| Option | Type | Default | Description | |--------------|-------------------|--------------------|-------------| | pages | string[] | [location.pathname] | HTML paths to index as knowledge base | | selector | string | 'main' | DOM selector to extract content from each page | | maxSentences | number | 2 | How many matched sentences to return in a reply | | title | string | 'Ask about this page' | Chat window header | | subtitle | string | 'AI Assistant' | Subheader in chat | | autoInit | boolean | true | Whether to auto-initialize on load | | welcome | string | Welcome message | First bot message shown | | analytics | boolean | false | If true, triggers a GoatCounter pageview ping for usage tracking |


🧠 How It Works

  1. On page load, it fetches all specified HTML pages.
  2. Extracts visible content using the given selector (defaults to <main>).
  3. Splits text into sentences and stores them in memory.
  4. User questions are matched against sentences using keyword scoring.
  5. Top N sentences are shown as answers.

🖼 Demo

Want to see it in action? Try a live example with:

<iframe src="https://yourdemo.com/about.html" width="400" height="600"></iframe>

📊 Tracking Usage

You can view public usage/download stats:

Optional: GoatCounter Analytics (Free)

To track actual page loads using this widget:

  1. Create a free account at https://www.goatcounter.com
  2. Use your site's GoatCounter ID, e.g., mychat.goatcounter.com
  3. By default, this widget pings https://mychat.goatcounter.com/count?p=/chatwidget
  4. No personal data collected; this is a free OSS-friendly analytics tool.

📄 License

MIT License. You’re free to use, modify, and distribute.


🙋 FAQ

Q: Can I use this with my personal website?
A: Yes! Just add a <script> tag and point it to your own HTML page(s).

Q: Does it use OpenAI or external AI services?
A: No. It's 100% client-side and works by matching text from your HTML files.

Q: Can I index multiple pages?
A: Yes, just pass them in the pages array in your setup config.

Q: What if setup isn’t called?
A: The widget logs a friendly reminder in the console but won’t crash your site.


🚀 Author & Attribution

Made by Siddharth Verma [Lead AI Engineer].

Want to build your own chatbot-enabled site? Start here!