mycast-ai

payload plugin ai completions

by mycast-ai
AI content generation
v1
^1.0.0
MIT

Overview

Summary generated from the README

Adds an admin interface for generating content for chosen collection fields using OpenAI's API. Each field gets a prompt, and defaults such as model, temperature and max tokens can be set globally. It is added through the plugins array and requires an OpenAI API key in the environment. It targets Payload 1.x and is marked as a work in progress.

Features

  • Per-field prompts configured by collection slug and field path
  • Default model, temperature, penalty and max token settings
  • Dashboard with a Complete All button and a minimalistic UI option
  • Context control with allowlist, denylist or omitting all fields
  • Supports text, textarea, rich text, date, email, code, group, tabs and collapsible fields

Use cases

  • Draft blog post bodies from a preset prompt inside the editing screen
  • Fill titles and descriptions across a collection with AI-generated text

From the author

Payload Plugin AI Completions: Generate dynamic content with OpenAI's API in Payload CMS.

Installation

npm i @mycast-ai/payload-plugin-ai-completions

8

Stars

0

Forks

3

Open Issues

3 years ago

Last Updated

12

Weekly Downloads

v0.0.1

npm Version

95.6 KB

Unpacked Size

2

Dependencies

GitHub stars

8+1 since Sep 7

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

12−2 since Sep 7

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

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

Health Score

28/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/692223457-root.svg)](https://payloaddirectory.dev/plugins/692223457-root)
HTML
<a href="https://payloaddirectory.dev/plugins/692223457-root"><img src="https://payloaddirectory.dev/badge/692223457-root.svg" alt="Payload Directory"></a>
Updated Sep 21, 2023Created Sep 15, 2023Published Sep 20, 2023

README

Payload Plugin AI Completions

A Payload CMS AI Completions plugin that utilizes OpenAI's API to generate content for fields. It provides an interface for generating content.

⚠️ Warning: Work in Progress ⚠️

This plugin is currently a work in progress and may not have all features implemented or may contain bugs. Use at your own risk.

Installation

pnpm add @mycast-ai/payload-plugin-ai-completions
# OR
yarn add @mycast-ai/payload-plugin-ai-completions
# OR
npm i @mycast-ai/payload-plugin-ai-completions

To install any plugin, simply add it to your payload.config.ts in the Plugin array.

import { aiCompletions } from '@mycast-ai/payload-plugin-ai-completions';

export const config = buildConfig({
  plugins: [
    // minimal configuration
    aiCompletions({
      enabled: true,
      collections: [
        {
          slug: 'your-collection-slug'
          fields: [
            {
              path: 'title',
              prompt: 'Tell me a joke!'
            }
          ]
        }
      ]
    }),
  ]
});

Usage

To use the plugin, make sure the plugin is enabled in the plugin options. You can also configure the default values and dashboard settings as desired. Add collections to the collections array to enable content generation for specific collections and fields.

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 ?

Supported fields

Currently the following field types are fully supported:

export const SUPPORTED_FIELD_TYPES = [
  'text',
  'textarea',
  'richtext',
  'collapsible',
  'date',
  'email',
  'group',
  'tabs',
  'code',
]

Supported configuration

export const config = buildConfig({
  plugins: [
    // You can pass options to the plugin
    aiCompletions({
      enabled: false, // Specify if the plugin is enabled or disabled
      defaults: {
        model: 'gpt-3.5-turbo-16k', // Specify the default model to use for generating content
        temperature: 1, // Specify the default temperature to use for generating content
        frequency_penalty: 0.0, // Specify the default frequency penalty to use for generating content
        presence_penalty: 0.0, // Specify the default presence penalty to use for generating content
        max_tokens: 2048, // Specify the default max tokens to use for generating content
      },
      dashboard: {
        collapsed: false, // Specify if the dashboard is collapsed by default
        completeAllButton: true, // Specify if the "Complete All" button is enabled in the dashboard
        minimalisticUi: true, // Specify if the dashboard has a minimalistic user interface
      },
      collections: [
        {
          slug: 'posts', // Specify the slug of the collection
          fields: [
            {
              path: 'body', // Specify the field path
              prompt: 'Write a blog post about', // Specify the prompt to generate content for the field
            },
          ],
          context: {
            // Context options for generating content
            denylist: ['title', 'description'], // Specify the fields to exclude in the content generation
            // allowlist: ['body']  // or
            // omitAllFields: true
          },
        },
      ],
    })]
})

📢 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.

Contributions

Contributions to this plugin are welcome. If you encounter any issues or have suggestions for improvements, please create a new issue in the repository.

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:seed to start the dev server and seed data.
  5. Open http://localhost:3000/admin in your browser.
  6. Log in using the username [email protected] and password test.

Similar plugins