payload-custom-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.1.33 • Public • Published

payload-custom-plugin

Install the following package to generate description through AI

npm i payload-custom-plugin

In Collection file import the ContentConfig from payload-custom-plugin

import { ContentConfig } from 'payload-custom-plugin';

instead of "import { CollectionConfig } from 'payload/types';"

Add OPENAI_API_KEY in .env file

OPENAI_API_KEY="Your OPEN API KEY"

Set autoDescription in constant in collection

autoDescription: true,

For which field want to generate description through AI provide name as "Title_"fieldname"" and where these description needs to show set the name of field as "Description_"fieldname"" e.g. " { name: 'Title_Tagline', type: 'text', label: 'Any Label', required: true, }, { name: 'Description_Tagline', type: 'textarea', label: 'Any label', admin: { condition: (_, siblingData) => !!siblingData.Description, }, }, "

For multiple fields generate the description according to Field value, give the field names after "Title_" and "Description_" e.g. " { name: 'Title_BulletedPoints', type: 'text', label: 'Any label', required: true, }, { name: 'Description_BulletedPoints', type: 'textarea', label: 'Any label', admin: { condition: (_, siblingData) => !!siblingData.Description, }, }, "

In payload.config.ts file import ContentGenerator from payload-custom-plugin

import ContentGenerator from 'payload-custom-plugin';

Define the collection in plugin instead of collections

plugins: [

ContentGenerator(collection_name),

],

run npm dev

While generating the content in payload dashboard use following indentations, e.g If you want to generate tagline for AWS use title field like "tagline : AWS"

If you want to generate description for AWS use title field like "description : AWS", you can provide word limit also before ":" like "100 word description : AWS"

Readme

Keywords

none

Package Sidebar

Install

npm i payload-custom-plugin

Weekly Downloads

154

Version

1.1.33

License

ISC

Unpacked Size

10.9 kB

Total Files

9

Last publish

Collaborators

  • rohanrenlume