diff --git a/README.md b/README.md index afad41d..f079cbb 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ - [x] Voice generation with ElevenLabs - [x] Image generation with OpenAI - [x] Field level prompt customization +- [ ] Analyse documents +- [ ] Automation of content creation workflows - [ ] Internationalization support ## 📋 Table of Contents diff --git a/package.json b/package.json index 81d59e5..a847d20 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@ashbuilds/payload-ai", + "name": "payload-plugin-ai", "version": "1.0.0", "private": false, "bugs": "https://github.com/ashbuilds/payload-ai/issues", diff --git a/src/defaults.ts b/src/defaults.ts index 64ee8e7..6d1da0a 100644 --- a/src/defaults.ts +++ b/src/defaults.ts @@ -1,12 +1,3 @@ -export const defaults = { - description: { - maxLength: 150, - minLength: 100, - }, - title: { - maxLength: 60, - minLength: 50, - }, -} - -export const PLUGIN_NAME = 'ai-plugin' +export const PLUGIN_NAME = 'plugin-ai' +export const PLUGIN_INSTRUCTIONS_TABLE = 'instructions' +export const PLUGIN_INSTRUCTIONS_MAP_GLOBAL = 'ai-plugin__instructions_map' diff --git a/src/exports/types.ts b/src/exports/types.ts index 7727e65..f21fe4a 100644 --- a/src/exports/types.ts +++ b/src/exports/types.ts @@ -1,2 +1,2 @@ -export type { payloadAiPlugin } from '../plugin.ts' +export type { payloadPluginAI } from '../plugin.ts' export type { PluginConfig } from '../types.ts' diff --git a/src/index.ts b/src/index.ts index 285c08d..fb991dd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1 @@ -export { payloadAiPlugin } from './plugin.js' +export { payloadPluginAI } from './plugin.js' diff --git a/src/plugin.ts b/src/plugin.ts index 25fc928..86e9cec 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -11,7 +11,7 @@ import { InstructionsProvider } from './providers/InstructionsProvider/Instructi import { translations } from './translations/index.js' import { updateFieldsConfig } from './utilities/updateFieldsConfig.js' -const payloadAiPlugin = +const payloadPluginAI = (pluginConfig: PluginConfig) => async (incomingConfig: Config): Promise => { const collections = [...(incomingConfig.collections ?? []), Instructions] @@ -68,10 +68,12 @@ const payloadAiPlugin = updatedConfig.onInit = async (payload) => { if (incomingConfig.onInit) await incomingConfig.onInit(payload) - init(payload, collectionsFieldPathMap) + init(payload, collectionsFieldPathMap).catch((error) => { + payload.logger.error(`— AI Plugin: Initialization Error: ${error}`) + }) } return updatedConfig } -export { payloadAiPlugin } +export { payloadPluginAI } diff --git a/src/types.ts b/src/types.ts index 7799d22..4c2ccd3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,5 +1,4 @@ -import type { DocumentInfoContext } from '@payloadcms/ui' -import type { Config, Endpoint, Field, GroupField } from 'payload' +import type { Endpoint, Field, GroupField } from 'payload' export interface PluginConfig { collections?: string[] @@ -68,7 +67,7 @@ export type UseMenuEvents = { } export type BaseItemProps = { + children?: React.ReactNode hideIcon?: boolean onClick: () => void - children?: React.ReactNode }