filipzava

payload plugin ai chat

by filipzava
AI content generation
v1
^1.15.2
MIT

Overview

Summary generated from the README

Adds ChatGPT-like chat functionality to selected Payload collections. It is registered in the plugins array and provides chat completion and admin chat completion endpoints. Requires an OpenAI API key set in the environment and targets Payload 1.x. The author marks it as in development.

Features

  • Enables chat functionality on chosen collections
  • Provides chat completion and admin chat completion endpoints
  • Configurable model, temperature, max tokens and penalties
  • Customizable group name and label in the admin panel
  • Can be switched on or off with an enabled flag

Use cases

  • Chat with OpenAI models from inside the Payload admin panel
  • Store AI chat conversations in a Payload collection

From the author

ChatGPT-like Plugin for Payload

Installation

npm i payload-plugin-ai-chat

15

Stars

1

Forks

2

Open Issues

3 years ago

Last Updated

13

Weekly Downloads

v0.1.0-beta.3

npm Version

52.5 KB

Unpacked Size

2

Dependencies

GitHub stars

150 since Sep 6

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 202615
Dec 4, 202615
Dec 3, 202615
Dec 2, 202615
Dec 1, 202615
Nov 30, 202615
Nov 29, 202615
Nov 28, 202615
Nov 27, 202615
Nov 26, 202615
Nov 25, 202615
Nov 24, 202615
Nov 23, 202615
Nov 22, 202615
Nov 21, 202615
Nov 20, 202615
Nov 19, 202615
Nov 18, 202615
Nov 17, 202615
Nov 16, 202615
Nov 15, 202615
Nov 14, 202615
Nov 13, 202615
Nov 12, 202615
Nov 11, 202615
Nov 10, 202615
Nov 9, 202615
Nov 8, 202615
Nov 7, 202615
Nov 6, 202615
Nov 5, 202615
Nov 4, 202615
Nov 3, 202615
Nov 2, 202615
Nov 1, 202615
Oct 31, 202615
Oct 30, 202615
Oct 29, 202615
Oct 28, 202615
Oct 27, 202615
Oct 26, 202615
Oct 25, 202615
Oct 24, 202615
Oct 23, 202615
Oct 22, 202615
Oct 21, 202615
Oct 20, 202615
Oct 19, 202615
Oct 18, 202615
Oct 17, 202615
Oct 16, 202615
Oct 15, 202615
Oct 14, 202615
Oct 13, 202615
Oct 12, 202615
Oct 11, 202615
Oct 10, 202615
Oct 9, 202615
Oct 8, 202615
Oct 7, 202615
Oct 6, 202615
Oct 5, 202615
Oct 4, 202615
Oct 3, 202615
Oct 2, 202615
Oct 1, 202615
Sep 30, 202615
Sep 29, 202615
Sep 28, 202615
Sep 27, 202615
Sep 26, 202615
Sep 25, 202615
Sep 24, 202615
Sep 23, 202615
Sep 22, 202615
Sep 21, 202615
Sep 20, 202615
Sep 19, 202615
Sep 18, 202615
Sep 17, 202615
Sep 16, 202615
Sep 15, 202615
Sep 14, 202615
Sep 13, 202615
Sep 12, 202615
Sep 11, 202615
Sep 10, 202615
Sep 9, 202615
Sep 8, 202615
Sep 7, 202615
Sep 6, 202615
npm weekly downloads

11+6 since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 202611
Dec 4, 20267
Dec 3, 20267
Dec 2, 20267
Dec 1, 202612
Nov 30, 202615
Nov 29, 202622
Nov 28, 202623
Nov 27, 202626
Nov 26, 202626
Nov 25, 202626
Nov 24, 202618
Nov 23, 202614
Nov 22, 20269
Nov 21, 20268
Nov 20, 202610
Nov 19, 202612
Nov 18, 202612
Nov 17, 202612
Nov 16, 202612
Nov 15, 202612
Nov 14, 202612
Nov 13, 20268
Nov 12, 20268
Nov 11, 20268
Nov 10, 20269
Nov 9, 202611
Nov 8, 202611
Nov 7, 202610
Nov 6, 20268
Nov 5, 20267
Nov 4, 202612
Nov 3, 202611
Nov 2, 202613
Nov 1, 202610
Oct 31, 202614
Oct 30, 202619
Oct 29, 202618
Oct 28, 202613
Oct 27, 202617
Oct 26, 202613
Oct 25, 202614
Oct 24, 202616
Oct 23, 202611
Oct 22, 202613
Oct 21, 202613
Oct 20, 202611
Oct 19, 202613
Oct 18, 202612
Oct 17, 20267
Oct 16, 20268
Oct 15, 20267
Oct 14, 20267
Oct 13, 20265
Oct 12, 20267
Oct 11, 20268
Oct 10, 20267
Oct 9, 20266
Oct 8, 20265
Oct 7, 20265
Oct 6, 20265
Oct 5, 20263
Oct 4, 20265
Oct 3, 20266
Oct 2, 20268
Oct 1, 20268
Sep 30, 20268
Sep 29, 202610
Sep 28, 20268
Sep 27, 20266
Sep 26, 20269
Sep 25, 20268
Sep 24, 20268
Sep 23, 20269
Sep 22, 202611
Sep 21, 202611
Sep 20, 202611
Sep 19, 20267
Sep 18, 20266
Sep 17, 20267
Sep 16, 20267
Sep 15, 20264
Sep 14, 20266
Sep 13, 20266
Sep 12, 20266
Sep 11, 20266
Sep 10, 20265
Sep 9, 20267
Sep 8, 20266
Sep 7, 20266
Sep 6, 20265

Each point is npm's rolling 7-day download count.

Health Score

34/100Fair

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/687694848-root.svg)](https://payloaddirectory.dev/plugins/687694848-root)
HTML
<a href="https://payloaddirectory.dev/plugins/687694848-root"><img src="https://payloaddirectory.dev/badge/687694848-root.svg" alt="Payload Directory"></a>
Updated Sep 7, 2023Created Sep 5, 2023Published Sep 7, 2023

README

🚀 AI Chat Payload Plugin

The AI Chat Payload Plugin is a plugin for Payload CMS that adds ChatGPT-like functionality to your collection. It enables seamless interaction with ChatGPT models within Payload and provides out-of-the-box chat completion and admin chat completion endpoints. This README file provides instructions on how to install and use the plugin.

⚠️ Please note that this plugin is still in development and may contain bugs or incomplete features. Your feedback and suggestions during the beta testing phase are highly appreciated.

📢 Feedback and Bug Reporting

During the beta testing phase, your feedback and bug reports play a crucial role in improving the plugin. If you encounter any issues, have suggestions for improvements, or need assistance, please open an issue on the GitHub repository. Your contributions will help make the AI Chat Payload Plugin more stable and reliable.

Thank you for participating in the beta testing phase of the AI Chat Payload Plugin! Your support and feedback are highly appreciated.

📥 Installation

You can install the AI Chat Payload Plugin using one of the following methods:

pnpm add payload-plugin-ai-chat
// or
yarn add payload-plugin-ai-chat
// or
npm i payload-plugin-ai-chat

Basic Usage

To use the AI Chat Payload Plugin, follow these steps:

  1. Add the plugin to the plugins array in your Payload config file.
  2. Configure the plugin options, including the collections you want to enable the AI Chat functionality for.
  3. Set other options such as the group name, group label, and defaults for AI chat parameters.
  4. Rename .env.example -> .env
  5. Set environment variable OPENAI_API_KEY. How to generate your API KEY ?

Here's an example of how to configure the plugin in your Payload config file:

import { buildConfig } from 'payload/config';
import { aiChat } from 'payload-plugin-ai-chat'

const config = buildConfig({
  collections: ['chats'],
  plugins: [
    aiChat({
      collections: ['chats'],
      groupName: 'aiChat',
      groupLabel: 'AI Chat',
      defaults: {
        model: 'gpt-3.5-turbo-16k',
        messageRole: 'user',
        temperature: 1,
        maxToken: 2_048,
        frequencyPenalty: 0,
        presencePenalty: 0,
      },
    })
  ]
});

export default config;

Options

The AI Chat Payload Plugin provides a set of configurable options to customize its functionality:

  • enabled (boolean | default: true): Flag to determine if the plugin functionality should be enabled or not.
  • collections (string[]): An array of collection slugs to enable the AI Chat functionality.
  • groupName (string | default: 'aiChat'): Name for the AI Chat group in your configuration.
  • groupLabel (string | default: 'AI Chat'): Display label for the AI Chat group in the Payload admin panel.
  • defaults (object): Set of default values for the AI Chat parameters.
    • model (string | default: 'gpt-3.5-turbo-16k'): Specifies which GPT model to use.
    • messageRole (string | default: 'user'): Role for the message (usually 'user' or 'assistant').
    • temperature (number | default: 1): Controls the randomness of the model's output.
    • maxToken (number | default: 2_048): Maximum number of tokens for the response.
    • frequencyPenalty (number | default: 0): Adjusts the likelihood of frequently used tokens appearing.
    • presencePenalty (number | default: 0): Adjusts the likelihood of new tokens appearing.

Make sure to have the OPENAI_API_KEY set in your environment variables for the plugin to work seamlessly. How to generate your API KEY ?

Development

To actively develop or debug this plugin, you can work directly within the dev directory of this repository or link your own project.

Internal Development

This repository includes a fully working, self-seeding instance of Payload. To spin up the dev, follow these steps:

  1. Clone the repository.
  2. Navigate to the root directory of the plugin repository and run yarn to install the dependencies.
  3. Navigate to the dev directory and run yarn to install the dev dependencies.
  4. Run yarn dev to start the dev server.
  5. Open http://localhost:3000/admin in your browser.
  6. Log in using the username [email protected] and password test.

The dev allows you to test and make changes to the plugin. Keep in mind that the dev database is automatically seeded on every startup, and any changes you make to the data will be destroyed each time you reboot the app.

Similar plugins