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

nodebb-plugin-ai-chat

v1.0.6

Published

A plugin to create AI chat bot that integrates with your external vector DB

Downloads

7

Readme

AI chat Plugin for NodeBB

AI-Powered Chat Integration: Enhance your NodeBB forum with an AI-powered chat feature that connects to your knowledge base. The plugin uses advanced Retrieval-Augmented Generation (RAG) with OpenAI's language model to provide intelligent responses based on community-indexed documents.

Seamless Authorization and WebSocket Communication: The plugin initiates a token request to the authorization server when the AI chat page loads. Once authenticated, it establishes a WebSocket connection with your knowledge base URL, ensuring real-time, secure communication.

Customizable Admin Settings: Admins can easily configure the plugin by providing necessary details such as the client ID, client secret, knowledge base URL, and authorization server URL. This ensures that the AI chat is tailored to your community's specific needs.

Dynamic AI Chat for Forums: The AI Chat Plugin for NodeBB enables dynamic, context-aware conversations within your forum. By leveraging your knowledge base, it provides accurate and relevant answers, enriching the user experience with AI-driven insights.

Easy Integration and Setup: Designed with simplicity in mind, the AI Chat Plugin can be quickly integrated into your NodeBB forum. With minimal setup required, you can offer your community an advanced AI chat system that leverages your existing knowledge base.

The plugin uses the filter:ai-chat.build hook to execute the loadValues method. This method is responsible for checking the token stored in the settings. If the token has expired, loadValues fetches a new token and updates the templateData. Additionally, if the Knowledge Base Server URL is changed in the admin settings, loadValues retrieves the updated URL and includes it in templateData.

The templateData is then utilized in the client-side through the action:ajaxify.dataLoaded hook to handle page navigation. When a page refresh occurs, the required data is fetched from the server using Socket.io with the following approach:

Client-side Code:

socket.emit('plugins.AIChatPlugin.getSettings', {}, function (err, data) {
    if (err) {
        console.log(err);
    } else {
        // Handle chat initialization with the received data
    }
});

Server-side Code:

socketPlugins.AIChatPlugin = {};
socketPlugins.AIChatPlugin.getSettings = function(socket, data, callback) {
    meta.settings.get('ai-chat')
    .then(settings => {
        let settingsData = { 
            'brain-url': settings['brain-url'],
            'token': settings['token'] 
        };
        callback(null, { data: settingsData });
    })
    .catch(err => {
        callback(err);
    });
};

This server-side code is registered in the plugin's init method, ensuring that the latest settings are always available for the chat functionality, regardless of whether the page is refreshed or navigated via links.

Installation

npm install nodebb-plugin-ai-chat

Screenshots

Don't forget to add screenshots!