@ai-stack/payloadcms 3.2.5-beta → 3.2.7-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/ai/models/anthropic/generateRichText.d.ts.map +1 -1
- package/dist/ai/models/elevenLabs/generateVoice.d.ts +1 -2
- package/dist/ai/models/elevenLabs/generateVoice.d.ts.map +1 -1
- package/dist/ai/models/elevenLabs/generateVoice.js.map +1 -1
- package/dist/ai/models/openai/generateImage.d.ts.map +1 -1
- package/dist/ai/models/openai/generateRichText.d.ts.map +1 -1
- package/dist/ai/models/openai/generateRichText.js +4 -8
- package/dist/ai/models/openai/generateRichText.js.map +1 -1
- package/dist/ai/models/openai/generateVoice.d.ts +1 -1
- package/dist/ai/models/openai/generateVoice.d.ts.map +1 -1
- package/dist/ai/prompts.d.ts.map +1 -1
- package/dist/ai/schemas/lexicalJsonSchema.d.ts +4 -0
- package/dist/ai/schemas/lexicalJsonSchema.d.ts.map +1 -1
- package/dist/ai/schemas/lexicalJsonSchema.js +8 -0
- package/dist/ai/schemas/lexicalJsonSchema.js.map +1 -1
- package/dist/ai/utils/systemGenerate.d.ts.map +1 -1
- package/dist/collections/Instructions.d.ts.map +1 -1
- package/dist/collections/Instructions.js +4 -2
- package/dist/collections/Instructions.js.map +1 -1
- package/dist/endpoints/index.js +1 -1
- package/dist/endpoints/index.js.map +1 -1
- package/dist/fields/ComposeField/ComposeField.d.ts +1 -2
- package/dist/fields/ComposeField/ComposeField.d.ts.map +1 -1
- package/dist/fields/ComposeField/ComposeField.js.map +1 -1
- package/dist/fields/LexicalEditor/ComposeFeatureComponent.d.ts.map +1 -1
- package/dist/fields/LexicalEditor/feature.client.d.ts.map +1 -1
- package/dist/fields/LexicalEditor/feature.client.js.map +1 -1
- package/dist/fields/SelectField/SelectField.d.ts.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/libraries/autocomplete/AutocompleteTextArea.d.ts.map +1 -1
- package/dist/libraries/handlebars/helpers.d.ts.map +1 -1
- package/dist/libraries/handlebars/replacePlaceholders.d.ts.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/providers/FieldProvider/FieldProvider.d.ts.map +1 -1
- package/dist/providers/InstructionsProvider/useInstructions.d.ts.map +1 -1
- package/dist/ui/Compose/Compose.d.ts +7 -3
- package/dist/ui/Compose/Compose.d.ts.map +1 -1
- package/dist/ui/Compose/Compose.js +37 -15
- package/dist/ui/Compose/Compose.js.map +1 -1
- package/dist/ui/Compose/UndoRedoActions.d.ts.map +1 -1
- package/dist/ui/Compose/UndoRedoActions.js +9 -9
- package/dist/ui/Compose/UndoRedoActions.js.map +1 -1
- package/dist/ui/Compose/compose.module.css +2 -0
- package/dist/ui/Compose/hooks/menu/Item.d.ts.map +1 -1
- package/dist/ui/Compose/hooks/menu/TranslateMenu.d.ts.map +1 -1
- package/dist/ui/Compose/hooks/menu/useMenu.d.ts.map +1 -1
- package/dist/ui/Compose/hooks/menu/useMenu.js +2 -4
- package/dist/ui/Compose/hooks/menu/useMenu.js.map +1 -1
- package/dist/ui/Compose/hooks/useGenerate.d.ts.map +1 -1
- package/dist/ui/Compose/hooks/useGenerate.js +22 -9
- package/dist/ui/Compose/hooks/useGenerate.js.map +1 -1
- package/dist/ui/Icons/Icons.d.ts.map +1 -1
- package/dist/ui/Icons/LottieAnimation.d.ts.map +1 -1
- package/dist/utilities/editorSchemaValidator.d.ts.map +1 -1
- package/dist/utilities/editorSchemaValidator.js +2 -1
- package/dist/utilities/editorSchemaValidator.js.map +1 -1
- package/dist/utilities/getFieldBySchemaPath.d.ts.map +1 -1
- package/dist/utilities/getFieldInfo.d.ts.map +1 -1
- package/dist/utilities/setSafeLexicalState.d.ts.map +1 -1
- package/dist/utilities/setSafeLexicalState.js +1 -1
- package/dist/utilities/setSafeLexicalState.js.map +1 -1
- package/dist/utilities/updateFieldsConfig.d.ts.map +1 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
The Payload AI Plugin is an advanced extension that integrates modern AI capabilities into your Payload CMS, streamlining content creation and management.
|
|
10
10
|
|
|
11
|
-
> **⚠️ Important:** This plugin is in active development. We're doing our best to improve its features and functionality. Please be prepared for regular updates; at the moment, the plugin has only been tested with Payload version v3.
|
|
11
|
+
> **⚠️ Important:** This plugin is in active development. We're doing our best to improve its features and functionality. Please be prepared for regular updates; at the moment, the plugin has only been tested with Payload version v3.31.0.
|
|
12
12
|
>
|
|
13
|
-
> To give it a try, we recommend using [Payload's website template](https://github.com/payloadcms/payload/tree/v3.
|
|
13
|
+
> To give it a try, we recommend using [Payload's website template](https://github.com/payloadcms/payload/tree/v3.31.0/templates/website).
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateRichText.d.ts","sourceRoot":"","sources":["../../../../src/ai/models/anthropic/generateRichText.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"generateRichText.d.ts","sourceRoot":"","sources":["../../../../src/ai/models/anthropic/generateRichText.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,GAAU,MAAM,MAAM,EAAE,SAAS,GAAG,sBAiChE,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type * as ElevenLabs from 'elevenlabs/api';
|
|
2
1
|
type ElevenLabsTextToSpeechOptions = {
|
|
3
2
|
voice_id: string;
|
|
4
|
-
}
|
|
3
|
+
};
|
|
5
4
|
export declare const generateVoice: (text: string, options: ElevenLabsTextToSpeechOptions) => Promise<{
|
|
6
5
|
alignment: string[];
|
|
7
6
|
buffer: Buffer<ArrayBuffer>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateVoice.d.ts","sourceRoot":"","sources":["../../../../src/ai/models/elevenLabs/generateVoice.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generateVoice.d.ts","sourceRoot":"","sources":["../../../../src/ai/models/elevenLabs/generateVoice.ts"],"names":[],"mappings":"AAEA,KAAK,6BAA6B,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,aAAa,GAAU,MAAM,MAAM,EAAE,SAAS,6BAA6B;;;EAoBvF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/ai/models/elevenLabs/generateVoice.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/ai/models/elevenLabs/generateVoice.ts"],"sourcesContent":["import { ElevenLabsClient } from 'elevenlabs'\n\ntype ElevenLabsTextToSpeechOptions = {\n voice_id: string\n}\n\nexport const generateVoice = async (text: string, options: ElevenLabsTextToSpeechOptions) => {\n const elevenLabs = new ElevenLabsClient({\n apiKey: process.env.ELEVENLABS_API_KEY,\n })\n const response = (await elevenLabs.textToSpeech.convertWithTimstamps(options.voice_id, {\n ...options,\n text,\n })) as {\n alignment: string[]\n audio_base64: string\n }\n if (response?.audio_base64) {\n const audioBuffer = Buffer.from(response.audio_base64, 'base64')\n // const transcript = convertToTranscript(mp3Audio.alignment)\n\n return {\n alignment: response.alignment,\n buffer: audioBuffer,\n }\n }\n}\n"],"names":["ElevenLabsClient","generateVoice","text","options","elevenLabs","apiKey","process","env","ELEVENLABS_API_KEY","response","textToSpeech","convertWithTimstamps","voice_id","audio_base64","audioBuffer","Buffer","from","alignment","buffer"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,aAAY;AAM7C,OAAO,MAAMC,gBAAgB,OAAOC,MAAcC;IAChD,MAAMC,aAAa,IAAIJ,iBAAiB;QACtCK,QAAQC,QAAQC,GAAG,CAACC,kBAAkB;IACxC;IACA,MAAMC,WAAY,MAAML,WAAWM,YAAY,CAACC,oBAAoB,CAACR,QAAQS,QAAQ,EAAE;QACrF,GAAGT,OAAO;QACVD;IACF;IAIA,IAAIO,UAAUI,cAAc;QAC1B,MAAMC,cAAcC,OAAOC,IAAI,CAACP,SAASI,YAAY,EAAE;QACvD,6DAA6D;QAE7D,OAAO;YACLI,WAAWR,SAASQ,SAAS;YAC7BC,QAAQJ;QACV;IACF;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateImage.d.ts","sourceRoot":"","sources":["../../../../src/ai/models/openai/generateImage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAIlE,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"generateImage.d.ts","sourceRoot":"","sources":["../../../../src/ai/models/openai/generateImage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAIlE,eAAO,MAAM,aAAa,GACxB,QAAQ,MAAM,EACd,4BAIG;IACD,IAAI,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAClC,KAAK,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAA;IACpC,OAAO,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAA;CAClC;;;EAiBP,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateRichText.d.ts","sourceRoot":"","sources":["../../../../src/ai/models/openai/generateRichText.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"generateRichText.d.ts","sourceRoot":"","sources":["../../../../src/ai/models/openai/generateRichText.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,GAAU,MAAM,MAAM,EAAE,UAAS,GAAQ,sBAoCrE,CAAA"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { openai } from '@ai-sdk/openai';
|
|
2
2
|
import { jsonSchema, streamObject } from 'ai';
|
|
3
3
|
export const generateRichText = async (text, options = {})=>{
|
|
4
|
-
console.log('Running handler with prompts:', options.editorSchema)
|
|
4
|
+
// console.log('Running handler with prompts:', options.editorSchema)
|
|
5
5
|
const streamResult = await streamObject({
|
|
6
6
|
maxTokens: options.maxTokens || 5000,
|
|
7
7
|
model: openai(options.model, {
|
|
8
8
|
structuredOutputs: true
|
|
9
9
|
}),
|
|
10
|
-
onFinish: (result)=>{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
rawResponse: result.rawResponse,
|
|
14
|
-
result
|
|
15
|
-
});
|
|
16
|
-
},
|
|
10
|
+
// onFinish: (result) => {
|
|
11
|
+
// console.log('Finished generating rich text:', { options, rawResponse: result.rawResponse, result })
|
|
12
|
+
// },
|
|
17
13
|
prompt: text,
|
|
18
14
|
schema: jsonSchema(options.editorSchema),
|
|
19
15
|
system: `${options.system}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/ai/models/openai/generateRichText.ts"],"sourcesContent":["import { openai } from '@ai-sdk/openai'\nimport { jsonSchema, streamObject } from 'ai'\n\nexport const generateRichText = async (text: string, options: any = {}) => {\n console.log('Running handler with prompts:', options.editorSchema)\n const streamResult = await streamObject({\n maxTokens: options.maxTokens || 5000,\n model: openai(options.model,{\n structuredOutputs: true,\n }),\n onFinish: (result) => {\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/ai/models/openai/generateRichText.ts"],"sourcesContent":["import { openai } from '@ai-sdk/openai'\nimport { jsonSchema, streamObject } from 'ai'\n\nexport const generateRichText = async (text: string, options: any = {}) => {\n // console.log('Running handler with prompts:', options.editorSchema)\n const streamResult = await streamObject({\n maxTokens: options.maxTokens || 5000,\n model: openai(options.model,{\n structuredOutputs: true,\n }),\n // onFinish: (result) => {\n // console.log('Finished generating rich text:', { options, rawResponse: result.rawResponse, result })\n // },\n prompt: text,\n schema: jsonSchema(options.editorSchema),\n system: `${options.system}\n\nRULES:\n- Generate original and unique content based on the given topic.\n- Strictly adhere to the specified layout and formatting instructions.\n- Utilize the provided rich text editor tools for appropriate formatting.\n- Ensure the output follows the structure of the sample output object.\n- Produce valid JSON with no undefined or null values.\n\nLAYOUT INSTRUCTIONS:\n${options.layout}\n\nRICH TEXT EDITOR TOOLS:\n- Use appropriate formatting tools such as bold, italic, or underline for emphasis where needed.\n- Apply correct heading levels (h1, h2, h3) for hierarchical structure.\n- Utilize bullet points or numbered lists as required by the layout.\n\nADDITIONAL GUIDELINES:\n- Ensure coherence and logical flow between all sections.\n- Maintain a consistent tone and style throughout the content.\n- Use clear and concise language appropriate for the target audience.\n`,\n })\n return streamResult.toTextStreamResponse()\n}\n"],"names":["openai","jsonSchema","streamObject","generateRichText","text","options","streamResult","maxTokens","model","structuredOutputs","prompt","schema","editorSchema","system","layout","toTextStreamResponse"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAgB;AACvC,SAASC,UAAU,EAAEC,YAAY,QAAQ,KAAI;AAE7C,OAAO,MAAMC,mBAAmB,OAAOC,MAAcC,UAAe,CAAC,CAAC;IACpE,qEAAqE;IACrE,MAAMC,eAAe,MAAMJ,aAAa;QACtCK,WAAWF,QAAQE,SAAS,IAAI;QAChCC,OAAOR,OAAOK,QAAQG,KAAK,EAAC;YAC1BC,mBAAmB;QACrB;QACA,0BAA0B;QAC1B,wGAAwG;QACxG,KAAK;QACLC,QAAQN;QACRO,QAAQV,WAAWI,QAAQO,YAAY;QACvCC,QAAQ,GAAGR,QAAQQ,MAAM,CAAC;;;;;;;;;;AAU9B,EAAER,QAAQS,MAAM,CAAC;;;;;;;;;;;AAWjB,CAAC;IACC;IACA,OAAOR,aAAaS,oBAAoB;AAC1C,EAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SpeechCreateParams } from 'openai/resources/audio/speech';
|
|
2
2
|
type OpenAITextToSpeechOptions = Exclude<SpeechCreateParams, 'input'>;
|
|
3
3
|
export declare const generateVoice: (text: string, options: OpenAITextToSpeechOptions) => Promise<{
|
|
4
|
-
buffer: Buffer<
|
|
4
|
+
buffer: Buffer<ArrayBuffer>;
|
|
5
5
|
}>;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=generateVoice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateVoice.d.ts","sourceRoot":"","sources":["../../../../src/ai/models/openai/generateVoice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAIvE,KAAK,yBAAyB,GAAG,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAA;AAErE,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"generateVoice.d.ts","sourceRoot":"","sources":["../../../../src/ai/models/openai/generateVoice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAIvE,KAAK,yBAAyB,GAAG,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAA;AAErE,eAAO,MAAM,aAAa,GAAU,MAAM,MAAM,EAAE,SAAS,yBAAyB;;EAiBnF,CAAA"}
|
package/dist/ai/prompts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/ai/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,KAAK,mBAAmB,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,KAAK,YAAY,GAAG;IAClB,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,mBAAmB,KAAK,MAAM,CAAA;IAClD,IAAI,EAAE,eAAe,CAAA;IACrB,MAAM,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,MAAM,CAAA;CACjD,CAAA;AAGD,eAAO,MAAM,mBAAmB,uLAIlB,CAAA;AAEd,eAAO,MAAM,cAAc,EAAE,YAAY,EAyGxC,CAAA;AAED,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/ai/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,KAAK,mBAAmB,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,KAAK,YAAY,GAAG;IAClB,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,mBAAmB,KAAK,MAAM,CAAA;IAClD,IAAI,EAAE,eAAe,CAAA;IACrB,MAAM,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,MAAM,CAAA;CACjD,CAAA;AAGD,eAAO,MAAM,mBAAmB,uLAIlB,CAAA;AAEd,eAAO,MAAM,cAAc,EAAE,YAAY,EAyGxC,CAAA;AAED,eAAO,MAAM,WAAW,GAAI;;;;;CAAiD;;;CA6G5E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicalJsonSchema.d.ts","sourceRoot":"","sources":["../../../src/ai/schemas/lexicalJsonSchema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"lexicalJsonSchema.d.ts","sourceRoot":"","sources":["../../../src/ai/schemas/lexicalJsonSchema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmW1B,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,mBAAgB,QAajD,CAAA"}
|
|
@@ -392,6 +392,13 @@ export const documentSchema = {
|
|
|
392
392
|
type: 'object',
|
|
393
393
|
additionalProperties: false,
|
|
394
394
|
properties: {
|
|
395
|
+
indent: {
|
|
396
|
+
type: 'number',
|
|
397
|
+
enum: [
|
|
398
|
+
0,
|
|
399
|
+
1
|
|
400
|
+
]
|
|
401
|
+
},
|
|
395
402
|
type: {
|
|
396
403
|
type: 'string',
|
|
397
404
|
enum: [
|
|
@@ -413,6 +420,7 @@ export const documentSchema = {
|
|
|
413
420
|
}
|
|
414
421
|
},
|
|
415
422
|
required: [
|
|
423
|
+
'indent',
|
|
416
424
|
'type',
|
|
417
425
|
'children'
|
|
418
426
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/ai/schemas/lexicalJsonSchema.ts"],"sourcesContent":["export const documentSchema = {\n type: 'object',\n $schema: 'http://json-schema.org/draft-07/schema#',\n additionalProperties: false,\n definitions: {\n // Text Node (Leaf Node)\n TextNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['text'] },\n detail: {\n type: 'number',\n description: 'Text detail flags',\n enum: [\n 0, // No details\n 1, // IS_DIRECTIONLESS\n 2, // IS_UNMERGEABLE\n 3, // IS_DIRECTIONLESS + IS_UNMERGEABLE\n ],\n examples: [\n { description: 'No special details', value: 0 },\n { description: 'Directionless', value: 1 },\n { description: 'Unmergeable', value: 2 },\n { description: 'Directionless + Unmergeable', value: 3 },\n ],\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n format: {\n type: 'number',\n description: `Format flags for text:\n 0 = No format\n 1 = Bold\n 2 = Italic\n 3 = Bold + Italic (1|2)\n 4 = Strikethrough\n 8 = Underline\n 9 = Bold + Underline (1|8)\n 16 = Code\n 32 = Subscript\n 64 = Superscript\n 128 = Highlight\n \n Formats can be combined using binary OR (|).\n Example combinations:\n - Bold + Italic = 1|2 = 3\n - Bold + Underline = 1|8 = 9\n - Italic + Underline = 2|8 = 10\n - Bold + Italic + Underline = 1|2|8 = 11`,\n },\n indent: { type: 'number' },\n mode: {\n type: 'number',\n description: 'Text mode flags',\n enum: [\n 0, // Normal\n 1, // Token\n 2, // Segmented\n ],\n examples: [\n { description: 'Normal text', value: 0 },\n { description: 'Token text', value: 1 },\n { description: 'Segmented text', value: 2 },\n ],\n },\n style: {\n type: 'string',\n description: 'CSS style string (e.g., \"color: red; font-size: 12px;\")',\n },\n text: { type: 'string' },\n version: { type: 'number' },\n },\n required: [\n 'type',\n 'text',\n 'format',\n 'style',\n 'mode',\n 'detail',\n 'direction',\n 'indent',\n 'version',\n ],\n },\n // Styled Table Cell Node\n TableCellNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['tablecell'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n colSpan: { type: 'number' },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n headerState: { type: 'number' },\n indent: { type: 'number' },\n version: { type: 'number' },\n width: {\n type: ['null'],\n enum: [null],\n },\n },\n required: [\n 'type',\n 'children',\n 'headerState',\n 'colSpan',\n 'width',\n 'direction',\n 'indent',\n 'version',\n ],\n },\n // Styled Table Row Node\n TableRowNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['tablerow'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TableCellNode',\n },\n },\n height: { type: 'number' },\n },\n required: ['type', 'children', 'height'],\n },\n // Styled Table Node\n TableNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['table'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TableRowNode',\n },\n },\n },\n required: ['type', 'children'],\n },\n // Heading Node\n HeadingNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['heading'] },\n children: {\n type: 'array',\n items: {\n anyOf: [{ $ref: '#/definitions/TextNode' }, { $ref: '#/definitions/LinkNode' }],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n indent: { type: 'number' },\n tag: { type: 'string', enum: ['h1', 'h2', 'h3'] },\n version: { type: 'number' },\n },\n required: ['type', 'tag', 'children', 'direction', 'indent', 'version'],\n },\n // Paragraph Node\n ParagraphNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['paragraph'] },\n children: {\n type: 'array',\n items: {\n anyOf: [\n { $ref: '#/definitions/TextNode' },\n { $ref: '#/definitions/LinkNode' },\n { $ref: '#/definitions/CodeNode' },\n ],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n format: { type: 'string', enum: ['start', 'center', 'right'] },\n indent: { type: 'number' },\n textFormat: { type: 'number' },\n textStyle: {\n type: 'string',\n description: 'CSS style string (e.g., \"color: red; font-size: 12px;\")',\n },\n version: { type: 'number' },\n },\n required: [\n 'type',\n 'children',\n 'direction',\n 'format',\n 'indent',\n 'textFormat',\n 'textStyle',\n 'version',\n ],\n },\n // Link Node\n LinkNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['link'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n url: { type: 'string' },\n },\n required: ['type', 'url', 'children'],\n },\n // List Item Node\n ListItemNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['listitem'] },\n children: {\n type: 'array',\n items: {\n anyOf: [{ $ref: '#/definitions/ParagraphNode' }, { $ref: '#/definitions/ListNode' }],\n },\n },\n },\n required: ['type', 'children'],\n },\n // List Node\n ListNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['list'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/ListItemNode',\n },\n },\n listType: { type: 'string', enum: ['bullet', 'number'] },\n },\n required: ['type', 'listType', 'children'],\n },\n // Quote Node\n QuoteNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['quote'] },\n children: {\n type: 'array',\n items: {\n anyOf: [{ $ref: '#/definitions/TextNode' }, { $ref: '#/definitions/ParagraphNode' }],\n },\n },\n },\n required: ['type', 'children'],\n },\n // Code Node\n CodeNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['code'] },\n code: { type: 'string' },\n language: { type: 'string' },\n },\n required: ['type', 'code', 'language'],\n },\n // Horizontal Rule Node\n HorizontalRuleNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['horizontalrule'] },\n },\n required: ['type'],\n },\n // Image Node\n ImageNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['image'] },\n alt: { type: 'string' },\n caption: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n src: { type: 'string' },\n },\n required: ['type', 'src', 'alt', 'caption'],\n },\n // Root Node\n RootNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['root'] },\n children: {\n type: 'array',\n items: {\n anyOf: [\n { $ref: '#/definitions/TextNode' },\n { $ref: '#/definitions/HeadingNode' },\n { $ref: '#/definitions/ParagraphNode' },\n { $ref: '#/definitions/LinkNode' },\n { $ref: '#/definitions/ListNode' },\n { $ref: '#/definitions/QuoteNode' },\n { $ref: '#/definitions/CodeNode' },\n { $ref: '#/definitions/HorizontalRuleNode' },\n { $ref: '#/definitions/ImageNode' },\n { $ref: '#/definitions/TableNode' },\n ],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n indent: { type: 'number' },\n version: { type: 'number' },\n },\n required: ['type', 'children', 'direction', 'indent', 'version'],\n },\n },\n properties: {\n root: {\n $ref: '#/definitions/RootNode',\n },\n },\n required: ['root'],\n}\n\nexport const lexicalJsonSchema = (customNodes = []) => {\n const schema = JSON.parse(JSON.stringify(documentSchema))\n\n // Add custom nodes to the Node definition\n if (customNodes.length > 0) {\n customNodes.forEach((customNode, index) => {\n const customNodeName = `CustomNode${index + 1}`\n schema.definitions[customNodeName] = customNode\n schema.definitions.Node.oneOf.push({ $ref: `#/definitions/${customNodeName}` })\n })\n }\n\n return schema\n}\n"],"names":["documentSchema","type","$schema","additionalProperties","definitions","TextNode","properties","enum","detail","description","examples","value","direction","format","indent","mode","style","text","version","required","TableCellNode","children","items","$ref","colSpan","headerState","width","TableRowNode","height","TableNode","HeadingNode","anyOf","tag","ParagraphNode","textFormat","textStyle","LinkNode","url","ListItemNode","ListNode","listType","QuoteNode","CodeNode","code","language","HorizontalRuleNode","ImageNode","alt","caption","src","RootNode","root","lexicalJsonSchema","customNodes","schema","JSON","parse","stringify","length","forEach","customNode","index","customNodeName","Node","oneOf","push"],"mappings":"AAAA,OAAO,MAAMA,iBAAiB;IAC5BC,MAAM;IACNC,SAAS;IACTC,sBAAsB;IACtBC,aAAa;QACX,wBAAwB;QACxBC,UAAU;YACRJ,MAAM;YACNE,sBAAsB;YACtBG,YAAY;gBACVL,MAAM;oBAAEA,MAAM;oBAAUM,MAAM;wBAAC;qBAAO;gBAAC;gBACvCC,QAAQ;oBACNP,MAAM;oBACNQ,aAAa;oBACbF,MAAM;wBACJ;wBACA;wBACA;wBACA;qBACD;oBACDG,UAAU;wBACR;4BAAED,aAAa;4BAAsBE,OAAO;wBAAE;wBAC9C;4BAAEF,aAAa;4BAAiBE,OAAO;wBAAE;wBACzC;4BAA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,0CAA0C;IAC1C,IAAIqD,YAAYK,MAAM,GAAG,GAAG;QAC1BL,YAAYM,OAAO,CAAC,CAACC,YAAYC;YAC/B,MAAMC,iBAAiB,CAAC,UAAU,EAAED,QAAQ,GAAG;YAC/CP,OAAOlD,WAAW,CAAC0D,eAAe,GAAGF;YACrCN,OAAOlD,WAAW,CAAC2D,IAAI,CAACC,KAAK,CAACC,IAAI,CAAC;gBAAE1C,MAAM,CAAC,cAAc,EAAEuC,gBAAgB;YAAC;QAC/E;IACF;IAEA,OAAOR;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/ai/schemas/lexicalJsonSchema.ts"],"sourcesContent":["export const documentSchema = {\n type: 'object',\n $schema: 'http://json-schema.org/draft-07/schema#',\n additionalProperties: false,\n definitions: {\n // Text Node (Leaf Node)\n TextNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['text'] },\n detail: {\n type: 'number',\n description: 'Text detail flags',\n enum: [\n 0, // No details\n 1, // IS_DIRECTIONLESS\n 2, // IS_UNMERGEABLE\n 3, // IS_DIRECTIONLESS + IS_UNMERGEABLE\n ],\n examples: [\n { description: 'No special details', value: 0 },\n { description: 'Directionless', value: 1 },\n { description: 'Unmergeable', value: 2 },\n { description: 'Directionless + Unmergeable', value: 3 },\n ],\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n format: {\n type: 'number',\n description: `Format flags for text:\n 0 = No format\n 1 = Bold\n 2 = Italic\n 3 = Bold + Italic (1|2)\n 4 = Strikethrough\n 8 = Underline\n 9 = Bold + Underline (1|8)\n 16 = Code\n 32 = Subscript\n 64 = Superscript\n 128 = Highlight\n \n Formats can be combined using binary OR (|).\n Example combinations:\n - Bold + Italic = 1|2 = 3\n - Bold + Underline = 1|8 = 9\n - Italic + Underline = 2|8 = 10\n - Bold + Italic + Underline = 1|2|8 = 11`,\n },\n indent: { type: 'number' },\n mode: {\n type: 'number',\n description: 'Text mode flags',\n enum: [\n 0, // Normal\n 1, // Token\n 2, // Segmented\n ],\n examples: [\n { description: 'Normal text', value: 0 },\n { description: 'Token text', value: 1 },\n { description: 'Segmented text', value: 2 },\n ],\n },\n style: {\n type: 'string',\n description: 'CSS style string (e.g., \"color: red; font-size: 12px;\")',\n },\n text: { type: 'string' },\n version: { type: 'number' },\n },\n required: [\n 'type',\n 'text',\n 'format',\n 'style',\n 'mode',\n 'detail',\n 'direction',\n 'indent',\n 'version',\n ],\n },\n // Styled Table Cell Node\n TableCellNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['tablecell'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n colSpan: { type: 'number' },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n headerState: { type: 'number' },\n indent: { type: 'number' },\n version: { type: 'number' },\n width: {\n type: ['null'],\n enum: [null],\n },\n },\n required: [\n 'type',\n 'children',\n 'headerState',\n 'colSpan',\n 'width',\n 'direction',\n 'indent',\n 'version',\n ],\n },\n // Styled Table Row Node\n TableRowNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['tablerow'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TableCellNode',\n },\n },\n height: { type: 'number' },\n },\n required: ['type', 'children', 'height'],\n },\n // Styled Table Node\n TableNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['table'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TableRowNode',\n },\n },\n },\n required: ['type', 'children'],\n },\n // Heading Node\n HeadingNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['heading'] },\n children: {\n type: 'array',\n items: {\n anyOf: [{ $ref: '#/definitions/TextNode' }, { $ref: '#/definitions/LinkNode' }],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n indent: { type: 'number' },\n tag: { type: 'string', enum: ['h1', 'h2', 'h3'] },\n version: { type: 'number' },\n },\n required: ['type', 'tag', 'children', 'direction', 'indent', 'version'],\n },\n // Paragraph Node\n ParagraphNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['paragraph'] },\n children: {\n type: 'array',\n items: {\n anyOf: [\n { $ref: '#/definitions/TextNode' },\n { $ref: '#/definitions/LinkNode' },\n { $ref: '#/definitions/CodeNode' },\n ],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n format: { type: 'string', enum: ['start', 'center', 'right'] },\n indent: { type: 'number' },\n textFormat: { type: 'number' },\n textStyle: {\n type: 'string',\n description: 'CSS style string (e.g., \"color: red; font-size: 12px;\")',\n },\n version: { type: 'number' },\n },\n required: [\n 'type',\n 'children',\n 'direction',\n 'format',\n 'indent',\n 'textFormat',\n 'textStyle',\n 'version',\n ],\n },\n // Link Node\n LinkNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['link'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n url: { type: 'string' },\n },\n required: ['type', 'url', 'children'],\n },\n // List Item Node\n ListItemNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n indent: { type: 'number', enum: [0, 1] },\n type: { type: 'string', enum: ['listitem'] },\n children: {\n type: 'array',\n items: {\n anyOf: [{ $ref: '#/definitions/ParagraphNode' }, { $ref: '#/definitions/ListNode' }],\n },\n },\n },\n required: ['indent', 'type', 'children'],\n },\n // List Node\n ListNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['list'] },\n children: {\n type: 'array',\n items: {\n $ref: '#/definitions/ListItemNode',\n },\n },\n listType: { type: 'string', enum: ['bullet', 'number'] },\n },\n required: ['type', 'listType', 'children'],\n },\n // Quote Node\n QuoteNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['quote'] },\n children: {\n type: 'array',\n items: {\n anyOf: [{ $ref: '#/definitions/TextNode' }, { $ref: '#/definitions/ParagraphNode' }],\n },\n },\n },\n required: ['type', 'children'],\n },\n // Code Node\n CodeNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['code'] },\n code: { type: 'string' },\n language: { type: 'string' },\n },\n required: ['type', 'code', 'language'],\n },\n // Horizontal Rule Node\n HorizontalRuleNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['horizontalrule'] },\n },\n required: ['type'],\n },\n // Image Node\n ImageNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['image'] },\n alt: { type: 'string' },\n caption: {\n type: 'array',\n items: {\n $ref: '#/definitions/TextNode',\n },\n },\n src: { type: 'string' },\n },\n required: ['type', 'src', 'alt', 'caption'],\n },\n // Root Node\n RootNode: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', enum: ['root'] },\n children: {\n type: 'array',\n items: {\n anyOf: [\n { $ref: '#/definitions/TextNode' },\n { $ref: '#/definitions/HeadingNode' },\n { $ref: '#/definitions/ParagraphNode' },\n { $ref: '#/definitions/LinkNode' },\n { $ref: '#/definitions/ListNode' },\n { $ref: '#/definitions/QuoteNode' },\n { $ref: '#/definitions/CodeNode' },\n { $ref: '#/definitions/HorizontalRuleNode' },\n { $ref: '#/definitions/ImageNode' },\n { $ref: '#/definitions/TableNode' },\n ],\n },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n indent: { type: 'number' },\n version: { type: 'number' },\n },\n required: ['type', 'children', 'direction', 'indent', 'version'],\n },\n },\n properties: {\n root: {\n $ref: '#/definitions/RootNode',\n },\n },\n required: ['root'],\n}\n\nexport const lexicalJsonSchema = (customNodes = []) => {\n const schema = JSON.parse(JSON.stringify(documentSchema))\n\n // Add custom nodes to the Node definition\n if (customNodes.length > 0) {\n customNodes.forEach((customNode, index) => {\n const customNodeName = `CustomNode${index + 1}`\n schema.definitions[customNodeName] = customNode\n schema.definitions.Node.oneOf.push({ $ref: `#/definitions/${customNodeName}` })\n })\n }\n\n return schema\n}\n"],"names":["documentSchema","type","$schema","additionalProperties","definitions","TextNode","properties","enum","detail","description","examples","value","direction","format","indent","mode","style","text","version","required","TableCellNode","children","items","$ref","colSpan","headerState","width","TableRowNode","height","TableNode","HeadingNode","anyOf","tag","ParagraphNode","textFormat","textStyle","LinkNode","url","ListItemNode","ListNode","listType","QuoteNode","CodeNode","code","language","HorizontalRuleNode","ImageNode","alt","caption","src","RootNode","root","lexicalJsonSchema","customNodes","schema","JSON","parse","stringify","length","forEach","customNode","index","customNodeName","Node","oneOf","push"],"mappings":"AAAA,OAAO,MAAMA,iBAAiB;IAC5BC,MAAM;IACNC,SAAS;IACTC,sBAAsB;IACtBC,aAAa;QACX,wBAAwB;QACxBC,UAAU;YACRJ,MAAM;YACNE,sBAAsB;YACtBG,YAAY;gBACVL,MAAM;oBAAEA,MAAM;oBAAUM,MAAM;wBAAC;qBAAO;gBAAC;gBACvCC,QAAQ;oBACNP,MAAM;oBACNQ,aAAa;oBACbF,MAAM;wBACJ;wBACA;wBACA;wBACA;qBACD;oBACDG,UAAU;wBACR;4BAAED,aAAa;4BAAsBE,OAAO;wBAAE;wBAC9C;4BAAEF,aAAa;4BAAiBE,OAAO;wBAAE;wBACzC;4BAAEF,aAAa;4BAAeE,OAAO;wBAAE;wBACvC;4BAAEF,aAAa;4BAA+BE,OAAO;wBAAE;qBACxD;gBACH;gBACAC,WAAW;oBACTX,MAAM;wBAAC;wBAAU;qBAAO;oBACxBM,MAAM;wBAAC;wBAAO;qBAAK;gBACrB;gBACAM,QAAQ;oBACNZ,MAAM;oBACNQ,aAAa,CAAC;;;;;;;;;;;;;;;;;;4CAkBoB,CAAC;gBACrC;gBACAK,QAAQ;oBAAEb,MAAM;gBAAS;gBACzBc,MAAM;oBACJd,MAAM;oBACNQ,aAAa;oBACbF,MAAM;wBACJ;wBACA;wBACA;qBACD;oBACDG,UAAU;wBACR;4BAAED,aA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,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systemGenerate.d.ts","sourceRoot":"","sources":["../../../src/ai/utils/systemGenerate.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"systemGenerate.d.ts","sourceRoot":"","sources":["../../../src/ai/utils/systemGenerate.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,GAAU,MAAM;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,oBAmB5E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Instructions.d.ts","sourceRoot":"","sources":["../../src/collections/Instructions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAc,MAAM,SAAS,CAAA;AA+B3D,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"Instructions.d.ts","sourceRoot":"","sources":["../../src/collections/Instructions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAc,MAAM,SAAS,CAAA;AA+B3D,eAAO,MAAM,sBAAsB,GAAI,UAAU,OAAO,CAAC,gBAAgB,CAAC,KACvE,gBAsKA,CAAA"}
|
|
@@ -38,7 +38,7 @@ export const instructionsCollection = (options)=>({
|
|
|
38
38
|
name: 'schema-path',
|
|
39
39
|
type: 'text',
|
|
40
40
|
admin: {
|
|
41
|
-
|
|
41
|
+
description: "Please don’t change this unless you're sure of what you're doing"
|
|
42
42
|
},
|
|
43
43
|
unique: true
|
|
44
44
|
},
|
|
@@ -46,7 +46,7 @@ export const instructionsCollection = (options)=>({
|
|
|
46
46
|
name: 'field-type',
|
|
47
47
|
type: 'select',
|
|
48
48
|
admin: {
|
|
49
|
-
|
|
49
|
+
description: "Please don’t change this unless you're sure of what you're doing"
|
|
50
50
|
},
|
|
51
51
|
defaultValue: 'text',
|
|
52
52
|
label: 'Field type',
|
|
@@ -106,6 +106,8 @@ export const instructionsCollection = (options)=>({
|
|
|
106
106
|
type: 'tabs',
|
|
107
107
|
tabs: [
|
|
108
108
|
{
|
|
109
|
+
// TODO: Add some info about the field to guide user
|
|
110
|
+
// TODO: Add some info about the field to guide user
|
|
109
111
|
description: 'The Prompt field allows you to define dynamic templates using placeholders (e.g., {{ fieldName }}) to customize output based on your data fields.',
|
|
110
112
|
fields: [
|
|
111
113
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/collections/Instructions.ts"],"sourcesContent":["import type { CollectionConfig, GroupField } from 'payload'\n\nimport { GenerationModels } from '../ai/models/index.js'\nimport { PLUGIN_INSTRUCTIONS_TABLE } from '../defaults.js'\n\nconst groupSettings = GenerationModels.reduce((fields, model) => {\n if (model.settings) {\n fields.push(model.settings)\n }\n return fields\n}, [] as GroupField[])\n\nconst modelOptions = GenerationModels.map((model) => {\n return {\n fields: model.fields,\n label: model.name,\n value: model.id,\n }\n})\n\nconst defaultAccessConfig = {\n create: () => true,\n read: () => true,\n update: () => true,\n}\n\nconst defaultAdminConfig = {\n group: 'Plugins',\n hidden: true,\n}\n\nexport const instructionsCollection = (options?: Partial<CollectionConfig>) =>\n <CollectionConfig>{\n slug: PLUGIN_INSTRUCTIONS_TABLE,\n access: {\n ...defaultAccessConfig,\n ...options?.access,\n },\n admin: {\n ...defaultAdminConfig,\n ...options?.admin,\n group: 'Plugins',\n },\n fields: [\n {\n name: 'schema-path',\n type: 'text',\n admin: {\n
|
|
1
|
+
{"version":3,"sources":["../../src/collections/Instructions.ts"],"sourcesContent":["import type { CollectionConfig, GroupField } from 'payload'\n\nimport { GenerationModels } from '../ai/models/index.js'\nimport { PLUGIN_INSTRUCTIONS_TABLE } from '../defaults.js'\n\nconst groupSettings = GenerationModels.reduce((fields, model) => {\n if (model.settings) {\n fields.push(model.settings)\n }\n return fields\n}, [] as GroupField[])\n\nconst modelOptions = GenerationModels.map((model) => {\n return {\n fields: model.fields,\n label: model.name,\n value: model.id,\n }\n})\n\nconst defaultAccessConfig = {\n create: () => true,\n read: () => true,\n update: () => true,\n}\n\nconst defaultAdminConfig = {\n group: 'Plugins',\n hidden: true,\n}\n\nexport const instructionsCollection = (options?: Partial<CollectionConfig>) =>\n <CollectionConfig>{\n slug: PLUGIN_INSTRUCTIONS_TABLE,\n access: {\n ...defaultAccessConfig,\n ...options?.access,\n },\n admin: {\n ...defaultAdminConfig,\n ...options?.admin,\n group: 'Plugins',\n },\n fields: [\n {\n name: 'schema-path',\n type: 'text',\n admin: {\n description: \"Please don’t change this unless you're sure of what you're doing\",\n },\n unique: true,\n },\n {\n name: 'field-type',\n type: 'select',\n admin: {\n description: \"Please don’t change this unless you're sure of what you're doing\",\n },\n defaultValue: 'text',\n label: 'Field type',\n options: [\n {\n label: 'text',\n value: 'text',\n },\n {\n label: 'textarea',\n value: 'textarea',\n },\n {\n label: 'upload',\n value: 'upload',\n },\n {\n label: 'richText',\n value: 'richText',\n },\n ],\n },\n {\n name: 'relation-to',\n type: 'text',\n admin: {\n condition: (_, current) => {\n return current['field-type'] === 'upload'\n },\n },\n label: 'Relation to',\n },\n {\n name: 'model-id',\n type: 'select',\n admin: {\n components: {\n Field: {\n clientProps: {\n filterByField: 'field-type',\n options: modelOptions,\n },\n path: '@ai-stack/payloadcms/fields#SelectField',\n },\n },\n },\n label: 'Model',\n options: modelOptions.map((option) => {\n return {\n label: option.label,\n value: option.value,\n }\n }),\n },\n {\n id: 'ai-prompts-tabs',\n type: 'tabs',\n tabs: [\n {\n // TODO: Add some info about the field to guide user\n description:\n 'The Prompt field allows you to define dynamic templates using placeholders (e.g., {{ fieldName }}) to customize output based on your data fields.',\n fields: [\n {\n name: 'prompt',\n type: 'textarea',\n admin: {\n components: {\n Field: '@ai-stack/payloadcms/fields#PromptEditorField',\n },\n },\n label: '',\n },\n ],\n label: 'Prompt',\n },\n {\n description: '',\n fields: [\n {\n name: 'system',\n type: 'textarea',\n admin: {\n condition: (_, current) => {\n return current['field-type'] === 'richText'\n },\n },\n defaultValue: `INSTRUCTIONS:\nYou are a highly skilled and professional blog writer,\nrenowned for crafting engaging and well-organized articles.\nWhen given a title, you meticulously create blogs that are not only\ninformative and accurate but also captivating and beautifully structured.`,\n label: '',\n },\n ],\n label: 'System prompt',\n },\n {\n // Note: Update when tabs PR is merged: https://github.com/payloadcms/payload/pull/8406\n // admin: {\n // condition: (_, current) => {\n // console.log('condition in tab', current)\n // return current['field-type'] === 'richText'\n // },\n // },\n description: '',\n fields: [\n {\n /**TODO's:\n * - Layouts can be saved in as an array\n * - user can add their own layout to collections and use it later for generate specific rich text\n * - user can select previously added layout\n */\n name: 'layout',\n type: 'textarea',\n admin: {\n condition: (_, current) => {\n return current['field-type'] === 'richText'\n },\n },\n defaultValue: `[paragraph] - Write a concise introduction (2-3 sentences) that outlines the main topic.\n[horizontalrule] - Insert a horizontal rule to separate the introduction from the main content.\n[list] - Create a list with 3-5 items. Each list item should contain:\n a. [heading] - A brief, descriptive heading (up to 5 words)\n b. [paragraph] - A short explanation or elaboration (1-2 sentences)\n[horizontalrule] - Insert another horizontal rule to separate the main content from the conclusion.\n[paragraph] - Compose a brief conclusion (2-3 sentences) summarizing the key points.\n[quote] - Include a relevant quote from a famous person, directly related to the topic. Format: \"Quote text.\" - Author Name`,\n label: '',\n },\n ],\n label: 'Layout',\n },\n ],\n },\n ...groupSettings,\n ],\n labels: {\n plural: 'Compose Settings',\n singular: 'Compose Setting',\n },\n }\n"],"names":["GenerationModels","PLUGIN_INSTRUCTIONS_TABLE","groupSettings","reduce","fields","model","settings","push","modelOptions","map","label","name","value","id","defaultAccessConfig","create","read","update","defaultAdminConfig","group","hidden","instructionsCollection","options","slug","access","admin","type","description","unique","defaultValue","condition","_","current","components","Field","clientProps","filterByField","path","option","tabs","labels","plural","singular"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,yBAAyB,QAAQ,iBAAgB;AAE1D,MAAMC,gBAAgBF,iBAAiBG,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QACZ;IACF,CAAA,EAAC"}
|
package/dist/endpoints/index.js
CHANGED
|
@@ -72,7 +72,7 @@ export const endpoints = {
|
|
|
72
72
|
systemPrompt: instructions.system,
|
|
73
73
|
template: promptTemplate
|
|
74
74
|
});
|
|
75
|
-
console.log('Running handler with prompts:', prompts)
|
|
75
|
+
// console.log('Running handler with prompts:', prompts)
|
|
76
76
|
return model.handler?.(prompts.prompt, {
|
|
77
77
|
...modelOptions,
|
|
78
78
|
editorSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/endpoints/index.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\n\nimport type { ActionMenuItems, Endpoints } from '../types.js'\n\nimport { GenerationModels } from '../ai/models/index.js'\nimport { defaultPrompts } from '../ai/prompts.js'\nimport {\n PLUGIN_API_ENDPOINT_GENERATE,\n PLUGIN_API_ENDPOINT_GENERATE_UPLOAD,\n PLUGIN_INSTRUCTIONS_TABLE,\n PLUGIN_NAME,\n} from '../defaults.js'\nimport { registerEditorHelper } from '../libraries/handlebars/helpers.js'\nimport { handlebarsHelpersMap } from '../libraries/handlebars/helpersMap.js'\nimport { replacePlaceholders } from '../libraries/handlebars/replacePlaceholders.js'\n\nconst assignPrompt = async (\n action: ActionMenuItems,\n {\n type,\n actionParams,\n context,\n field,\n layout,\n systemPrompt = '',\n template,\n }: {\n actionParams: Record<any, any>\n context: object\n field: string\n layout: string\n systemPrompt: string\n template: string\n type: string\n },\n) => {\n const prompt = await replacePlaceholders(template, context)\n const toLexicalHTML = type === 'richText' ? handlebarsHelpersMap.toHTML.name : ''\n\n const assignedPrompts = {\n layout: type === 'richText' ? layout : undefined,\n prompt,\n //TODO: Define only once on a collection level\n system: type === 'richText' ? systemPrompt : undefined,\n }\n\n if (action === 'Compose') {\n return assignedPrompts\n }\n\n const { layout: getLayout, system: getSystemPrompt } = defaultPrompts.find(\n (p) => p.name === action,\n )\n\n let updatedLayout = layout\n if (getLayout) {\n updatedLayout = getLayout()\n }\n\n const system = getSystemPrompt({\n ...(actionParams || {}),\n prompt,\n systemPrompt,\n })\n\n return {\n layout: updatedLayout,\n // TODO: revisit this toLexicalHTML\n prompt: await replacePlaceholders(`{{${toLexicalHTML} ${field}}}`, context),\n system,\n }\n}\n\nexport const endpoints: Endpoints = {\n textarea: { //TODO: This is the main endpoint for generating content - its just needs to be renamed to 'generate' or something.\n handler: async (req: PayloadRequest) => {\n const data = await req.json?.()\n\n const { locale = 'en', options } = data\n const { action, actionParams, instructionId } = options\n const contextData = data.doc\n\n if (!instructionId) {\n throw new Error(\n `Instruction ID is required for \"${PLUGIN_NAME}\" to work, please check your configuration`,\n )\n }\n\n const instructions = await req.payload.findByID({\n id: instructionId,\n collection: PLUGIN_INSTRUCTIONS_TABLE,\n })\n\n const { collections } = req.payload.config\n const collection = collections.find(\n (collection) => collection.slug === PLUGIN_INSTRUCTIONS_TABLE,\n )\n\n const { custom: { [PLUGIN_NAME]: { editorConfig = {} } = {} } = {} } = collection.admin\n const { schema: editorSchema = {} } = editorConfig\n const { prompt: promptTemplate = '' } = instructions\n\n const schemaPath = instructions['schema-path'] as string\n const fieldName = schemaPath?.split('.').pop()\n\n registerEditorHelper(req.payload, schemaPath)\n\n const { defaultLocale, locales = [] } = req.payload.config.localization || {}\n const localeData = locales.find((l) => {\n return l.code === locale\n })\n\n const localeInfo = localeData?.label[defaultLocale] || locale\n\n const model = GenerationModels.find((model) => model.id === instructions['model-id'])\n const settingsName = model.settings?.name\n const modelOptions = instructions[settingsName] || {}\n\n const prompts = await assignPrompt(action, {\n type: instructions['field-type'] as string,\n actionParams,\n context: contextData,\n field: fieldName,\n layout: instructions.layout,\n systemPrompt: instructions.system,\n template: promptTemplate as string,\n })\n\n console.log('Running handler with prompts:', prompts)\n return model\n .handler?.(prompts.prompt, {\n ...modelOptions,\n editorSchema,\n layout: prompts.layout,\n locale: localeInfo,\n system: prompts.system,\n })\n .catch((error) => {\n console.error('Error: endpoint - generating text:', error)\n return new Response(JSON.stringify(error.message), { status: 500 })\n })\n },\n method: 'post',\n path: PLUGIN_API_ENDPOINT_GENERATE,\n },\n upload: {\n handler: async (req: PayloadRequest) => {\n const data = await req.json?.()\n\n const { options } = data\n const { instructionId } = options\n const contextData = data.doc\n\n let instructions = { 'model-id': '', prompt: '' }\n\n if (instructionId) {\n // @ts-expect-error\n instructions = await req.payload.findByID({\n id: instructionId,\n collection: PLUGIN_INSTRUCTIONS_TABLE,\n })\n }\n\n const { prompt: promptTemplate = '' } = instructions\n const schemaPath = instructions['schema-path']\n\n registerEditorHelper(req.payload, schemaPath)\n\n const text = await replacePlaceholders(promptTemplate, contextData)\n const modelId = instructions['model-id']\n const uploadCollectionSlug = instructions['relation-to']\n\n const model = GenerationModels.find((model) => model.id === modelId)\n const settingsName = model.settings?.name\n const modelOptions = instructions[settingsName] || {}\n\n const result = await model.handler?.(text, modelOptions)\n\n const assetData = await req.payload.create({\n collection: uploadCollectionSlug,\n data: result.data,\n file: result.file,\n })\n\n return new Response(\n JSON.stringify({\n result: {\n id: assetData.id,\n alt: assetData.alt,\n },\n }),\n )\n },\n method: 'post',\n path: PLUGIN_API_ENDPOINT_GENERATE_UPLOAD,\n },\n}\n"],"names":["GenerationModels","defaultPrompts","PLUGIN_API_ENDPOINT_GENERATE","PLUGIN_API_ENDPOINT_GENERATE_UPLOAD","PLUGIN_INSTRUCTIONS_TABLE","PLUGIN_NAME","registerEditorHelper","handlebarsHelpersMap","replacePlaceholders","assignPrompt","action","type","actionParams","context","field","layout","systemPrompt","template","prompt","toLexicalHTML","toHTML","name","assignedPrompts","undefined","system","getLayout","getSystemPrompt","find","p","updatedLayout","endpoints","textarea","handler","req","data","json","locale","options","instructionId","contextData","doc","Error","instructions","payload","findByID","id","collection","collections","config","slug","custom","editorConfig","admin","schema","editorSchema","promptTemplate","schemaPath","fieldName","split","pop","defaultLocale","locales","localization","localeData","l","code","localeInfo","label","model","settingsName","settings","modelOptions","prompts","console","log","catch","error","Response","JSON","stringify","message","status","method","path","upload","text","modelId","uploadCollectionSlug","result","assetData","create","file","alt"],"mappings":"AAIA,SAASA,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,cAAc,QAAQ,mBAAkB;AACjD,SACEC,4BAA4B,EAC5BC,mCAAmC,EACnCC,yBAAyB,EACzBC,WAAW,QACN,iBAAgB;AACvB,SAASC,oBAAoB,QAAQ,qCAAoC;AACzE,SAASC,oBAAoB,QAAQ,wCAAuC;AAC5E,SAASC,mBAAmB,QAAQ,iDAAgD;AAEpF,MAAMC,eAAe,OACnBC,QACA,EACEC,IAAI,EACJC,YAAY,EACZC,OAAO,EACPC,KAAK,EACLC,MAAM,EACNC,eAAe,EAAE,EACjBC,QAAQ,EAST;IAED,MAAMC,SAAS,MAAMV,oBAAoBS,UAAUJ;IACnD,MAAMM,gBAAgBR,SAAS,aAAaJ,qBAAqBa,MAAM,CAACC,IAAI,GAAG;IAE/E,MAAMC,kBAAkB;QACtBP,QAAQJ,SAAS,aAAaI,SAASQ;QACvCL;QACA,8CAA8C;QAC9CM,QAAQb,SAAS,aAAaK,eAAeO;IAC/C;IAEA,IAAIb,WAAW,WAAW;QACxB,OAAOY;IACT;IAEA,MAAM,EAAEP,QAAQU,SAAS,EAAED,QAAQE,eAAe,EAAE,GAAGzB,eAAe0B,IAAI,CACxE,CAACC,IAAMA,EAAEP,IAAI,KAAKX;IAGpB,IAAImB,gBAAgBd;IACpB,IAAIU,WAAW;QACbI,gBAAgBJ;IAClB;IAEA,MAAMD,SAASE,gBAAgB;QAC7B,GAAId,gBAAgB,CAAC,CAAC;QACtBM;QACAF;IACF;IAEA,OAAO;QACLD,QAAQc;QACR,mCAAmC;QACnCX,QAAQ,MAAMV,oBAAoB,CAAC,EAAE,EAAEW,cAAc,CAAC,EAAEL,MAAM,EAAE,CAAC,EAAED;QACnEW;IACF;AACF;AAEA,OAAO,MAAMM,YAAuB;IAClCC,UAAU;QACRC,SAAS,OAAOC;YACd,MAAMC,OAAO,MAAMD,IAAIE,IAAI;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;YAElC,MAAM6B,OAAO,MAAM7E,oBAAoB+C,gBAAgBhB;YACvD,MAAM+C,UAAU5C,YAAY,CAAC,WAAW;YACxC,MAAM6C,uBAAuB7C,YAAY,CAAC,cAAc;YAExD,MAAM0B,QAAQpE,iBAAiB2B,IAAI,CAAC,CAACyC,QAAUA,MAAMvB,EAAE,KAAKyC;YAC5D,MAAMjB,eAAeD,MAAME,QAAQ,EAAEjD;YACrC,MAAMkD,eAAe7B,YAAY,CAAC2B,aAAa,IAAI,CAAC;YAEpD,MAAMmB,SAAS,MAAMpB,MAAMpC,OAAO,GAAGqD,MAAMd;YAE3C,MAAMkB,YAAY,MAAMxD,IAAIU,OAAO,CAAC+C,MAAM,CAAC;gBACzC5C,YAAYyC;gBACZrD,MAAMsD,OAAOtD,IAAI;gBACjByD,MAAMH,OAAOG,IAAI;YACnB;YAEA,OAAO,IAAId,SACTC,KAAKC,SAAS,CAAC;gBACbS,QAAQ;oBACN3C,IAAI4C,UAAU5C,EAAE;oBAChB+C,KAAKH,UAAUG,GAAG;gBACpB;YACF;QAEJ;QACAV,QAAQ;QACRC,MAAMhF;IACR;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/endpoints/index.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\n\nimport type { ActionMenuItems, Endpoints } from '../types.js'\n\nimport { GenerationModels } from '../ai/models/index.js'\nimport { defaultPrompts } from '../ai/prompts.js'\nimport {\n PLUGIN_API_ENDPOINT_GENERATE,\n PLUGIN_API_ENDPOINT_GENERATE_UPLOAD,\n PLUGIN_INSTRUCTIONS_TABLE,\n PLUGIN_NAME,\n} from '../defaults.js'\nimport { registerEditorHelper } from '../libraries/handlebars/helpers.js'\nimport { handlebarsHelpersMap } from '../libraries/handlebars/helpersMap.js'\nimport { replacePlaceholders } from '../libraries/handlebars/replacePlaceholders.js'\n\nconst assignPrompt = async (\n action: ActionMenuItems,\n {\n type,\n actionParams,\n context,\n field,\n layout,\n systemPrompt = '',\n template,\n }: {\n actionParams: Record<any, any>\n context: object\n field: string\n layout: string\n systemPrompt: string\n template: string\n type: string\n },\n) => {\n const prompt = await replacePlaceholders(template, context)\n const toLexicalHTML = type === 'richText' ? handlebarsHelpersMap.toHTML.name : ''\n\n const assignedPrompts = {\n layout: type === 'richText' ? layout : undefined,\n prompt,\n //TODO: Define only once on a collection level\n system: type === 'richText' ? systemPrompt : undefined,\n }\n\n if (action === 'Compose') {\n return assignedPrompts\n }\n\n const { layout: getLayout, system: getSystemPrompt } = defaultPrompts.find(\n (p) => p.name === action,\n )\n\n let updatedLayout = layout\n if (getLayout) {\n updatedLayout = getLayout()\n }\n\n const system = getSystemPrompt({\n ...(actionParams || {}),\n prompt,\n systemPrompt,\n })\n\n return {\n layout: updatedLayout,\n // TODO: revisit this toLexicalHTML\n prompt: await replacePlaceholders(`{{${toLexicalHTML} ${field}}}`, context),\n system,\n }\n}\n\nexport const endpoints: Endpoints = {\n textarea: { //TODO: This is the main endpoint for generating content - its just needs to be renamed to 'generate' or something.\n handler: async (req: PayloadRequest) => {\n const data = await req.json?.()\n\n const { locale = 'en', options } = data\n const { action, actionParams, instructionId } = options\n const contextData = data.doc\n\n if (!instructionId) {\n throw new Error(\n `Instruction ID is required for \"${PLUGIN_NAME}\" to work, please check your configuration`,\n )\n }\n\n const instructions = await req.payload.findByID({\n id: instructionId,\n collection: PLUGIN_INSTRUCTIONS_TABLE,\n })\n\n const { collections } = req.payload.config\n const collection = collections.find(\n (collection) => collection.slug === PLUGIN_INSTRUCTIONS_TABLE,\n )\n\n const { custom: { [PLUGIN_NAME]: { editorConfig = {} } = {} } = {} } = collection.admin\n const { schema: editorSchema = {} } = editorConfig\n const { prompt: promptTemplate = '' } = instructions\n\n const schemaPath = instructions['schema-path'] as string\n const fieldName = schemaPath?.split('.').pop()\n\n registerEditorHelper(req.payload, schemaPath)\n\n const { defaultLocale, locales = [] } = req.payload.config.localization || {}\n const localeData = locales.find((l) => {\n return l.code === locale\n })\n\n const localeInfo = localeData?.label[defaultLocale] || locale\n\n const model = GenerationModels.find((model) => model.id === instructions['model-id'])\n const settingsName = model.settings?.name\n const modelOptions = instructions[settingsName] || {}\n\n const prompts = await assignPrompt(action, {\n type: instructions['field-type'] as string,\n actionParams,\n context: contextData,\n field: fieldName,\n layout: instructions.layout,\n systemPrompt: instructions.system,\n template: promptTemplate as string,\n })\n\n // console.log('Running handler with prompts:', prompts)\n return model\n .handler?.(prompts.prompt, {\n ...modelOptions,\n editorSchema,\n layout: prompts.layout,\n locale: localeInfo,\n system: prompts.system,\n })\n .catch((error) => {\n console.error('Error: endpoint - generating text:', error)\n return new Response(JSON.stringify(error.message), { status: 500 })\n })\n },\n method: 'post',\n path: PLUGIN_API_ENDPOINT_GENERATE,\n },\n upload: {\n handler: async (req: PayloadRequest) => {\n const data = await req.json?.()\n\n const { options } = data\n const { instructionId } = options\n const contextData = data.doc\n\n let instructions = { 'model-id': '', prompt: '' }\n\n if (instructionId) {\n // @ts-expect-error\n instructions = await req.payload.findByID({\n id: instructionId,\n collection: PLUGIN_INSTRUCTIONS_TABLE,\n })\n }\n\n const { prompt: promptTemplate = '' } = instructions\n const schemaPath = instructions['schema-path']\n\n registerEditorHelper(req.payload, schemaPath)\n\n const text = await replacePlaceholders(promptTemplate, contextData)\n const modelId = instructions['model-id']\n const uploadCollectionSlug = instructions['relation-to']\n\n const model = GenerationModels.find((model) => model.id === modelId)\n const settingsName = model.settings?.name\n const modelOptions = instructions[settingsName] || {}\n\n const result = await model.handler?.(text, modelOptions)\n\n const assetData = await req.payload.create({\n collection: uploadCollectionSlug,\n data: result.data,\n file: result.file,\n })\n\n return new Response(\n JSON.stringify({\n result: {\n id: assetData.id,\n alt: assetData.alt,\n },\n }),\n )\n },\n method: 'post',\n path: PLUGIN_API_ENDPOINT_GENERATE_UPLOAD,\n },\n}\n"],"names":["GenerationModels","defaultPrompts","PLUGIN_API_ENDPOINT_GENERATE","PLUGIN_API_ENDPOINT_GENERATE_UPLOAD","PLUGIN_INSTRUCTIONS_TABLE","PLUGIN_NAME","registerEditorHelper","handlebarsHelpersMap","replacePlaceholders","assignPrompt","action","type","actionParams","context","field","layout","systemPrompt","template","prompt","toLexicalHTML","toHTML","name","assignedPrompts","undefined","system","getLayout","getSystemPrompt","find","p","updatedLayout","endpoints","textarea","handler","req","data","json","locale","options","instructionId","contextData","doc","Error","instructions","payload","findByID","id","collection","collections","config","slug","custom","editorConfig","admin","schema","editorSchema","promptTemplate","schemaPath","fieldName","split","pop","defaultLocale","locales","localization","localeData","l","code","localeInfo","label","model","settingsName","settings","modelOptions","prompts","catch","error","console","Response","JSON","stringify","message","status","method","path","upload","text","modelId","uploadCollectionSlug","result","assetData","create","file","alt"],"mappings":"AAIA,SAASA,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,cAAc,QAAQ,mBAAkB;AACjD,SACEC,4BAA4B,EAC5BC,mCAAmC,EACnCC,yBAAyB,EACzBC,WAAW,QACN,iBAAgB;AACvB,SAASC,oBAAoB,QAAQ,qCAAoC;AACzE,SAASC,oBAAoB,QAAQ,wCAAuC;AAC5E,SAASC,mBAAmB,QAAQ,iDAAgD;AAEpF,MAAMC,eAAe,OACnBC,QACA,EACEC,IAAI,EACJC,YAAY,EACZC,OAAO,EACPC,KAAK,EACLC,MAAM,EACNC,eAAe,EAAE,EACjBC,QAAQ,EAST;IAED,MAAMC,SAAS,MAAMV,oBAAoBS,UAAUJ;IACnD,MAAMM,gBAAgBR,SAAS,aAAaJ,qBAAqBa,MAAM,CAACC,IAAI,GAAG;IAE/E,MAAMC,kBAAkB;QACtBP,QAAQJ,SAAS,aAAaI,SAASQ;QACvCL;QACA,8CAA8C;QAC9CM,QAAQb,SAAS,aAAaK,eAAeO;IAC/C;IAEA,IAAIb,WAAW,WAAW;QACxB,OAAOY;IACT;IAEA,MAAM,EAAEP,QAAQU,SAAS,EAAED,QAAQE,eAAe,EAAE,GAAGzB,eAAe0B,IAAI,CACxE,CAACC,IAAMA,EAAEP,IAAI,KAAKX;IA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GAAGD;YAC1B,MAAME,cAAcL,KAAKM,GAAG;YAE5B,IAAIE,eAAe;gBAAE,YAAY;gBAAIxB,QAAQ;YAAG;YAEhD,IAAIoB,eAAe;gBACjB,mBAAmB;gBACnBI,eAAe,MAAMT,IAAIU,OAAO,CAACC,QAAQ,CAAC;oBACxCC,IAAIP;oBACJQ,YAAY1C;gBACd;YACF;YAEA,MAAM,EAAEc,QAAQqC,iBAAiB,EAAE,EAAE,GAAGb;YACxC,MAAMc,aAAad,YAAY,CAAC,cAAc;YAE9CpC,qBAAqB2B,IAAIU,OAAO,EAAEa;YAElC,MAAM4B,OAAO,MAAM5E,oBAAoB+C,gBAAgBhB;YACvD,MAAM8C,UAAU3C,YAAY,CAAC,WAAW;YACxC,MAAM4C,uBAAuB5C,YAAY,CAAC,cAAc;YAExD,MAAM0B,QAAQpE,iBAAiB2B,IAAI,CAAC,CAACyC,QAAUA,MAAMvB,EAAE,KAAKwC;YAC5D,MAAMhB,eAAeD,MAAME,QAAQ,EAAEjD;YACrC,MAAMkD,eAAe7B,YAAY,CAAC2B,aAAa,IAAI,CAAC;YAEpD,MAAMkB,SAAS,MAAMnB,MAAMpC,OAAO,GAAGoD,MAAMb;YAE3C,MAAMiB,YAAY,MAAMvD,IAAIU,OAAO,CAAC8C,MAAM,CAAC;gBACzC3C,YAAYwC;gBACZpD,MAAMqD,OAAOrD,IAAI;gBACjBwD,MAAMH,OAAOG,IAAI;YACnB;YAEA,OAAO,IAAId,SACTC,KAAKC,SAAS,CAAC;gBACbS,QAAQ;oBACN1C,IAAI2C,UAAU3C,EAAE;oBAChB8C,KAAKH,UAAUG,GAAG;gBACpB;YACF;QAEJ;QACAV,QAAQ;QACRC,MAAM/E;IACR;AACF,EAAC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const ComposeField: (props: FieldDescriptionServerProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const ComposeField: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
3
2
|
//# sourceMappingURL=ComposeField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposeField.d.ts","sourceRoot":"","sources":["../../../src/fields/ComposeField/ComposeField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ComposeField.d.ts","sourceRoot":"","sources":["../../../src/fields/ComposeField/ComposeField.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY,GAAI,UAAK,4CAiBjC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/ComposeField/ComposeField.tsx"],"sourcesContent":["'use client'\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/ComposeField/ComposeField.tsx"],"sourcesContent":["'use client'\n\nimport React from 'react'\n\nimport { FieldProvider } from '../../providers/FieldProvider/FieldProvider.js'\nimport { useInstructions } from '../../providers/InstructionsProvider/useInstructions.js'\nimport { Compose } from '../../ui/Compose/Compose.js'\n\nexport const ComposeField = (props) => {\n\n const { id: instructionId } = useInstructions({\n schemaPath: props?.schemaPath,\n })\n\n return (\n <FieldProvider\n context={{\n type: props?.field.type,\n path: props?.path,\n schemaPath: props?.schemaPath,\n }}\n >\n <Compose descriptionProps={props} instructionId={instructionId} />\n </FieldProvider>\n )\n}\n"],"names":["React","FieldProvider","useInstructions","Compose","ComposeField","props","id","instructionId","schemaPath","context","type","field","path","descriptionProps"],"mappings":"AAAA;;AAEA,OAAOA,WAAW,QAAO;AAEzB,SAASC,aAAa,QAAQ,iDAAgD;AAC9E,SAASC,eAAe,QAAQ,0DAAyD;AACzF,SAASC,OAAO,QAAQ,8BAA6B;AAErD,OAAO,MAAMC,eAAe,CAACC;IAE3B,MAAM,EAAEC,IAAIC,aAAa,EAAE,GAAGL,gBAAgB;QAC5CM,YAAYH,OAAOG;IACrB;IAEA,qBACE,KAACP;QACCQ,SAAS;YACPC,MAAML,OAAOM,MAAMD;YACnBE,MAAMP,OAAOO;YACbJ,YAAYH,OAAOG;QACrB;kBAEA,cAAA,KAACL;YAAQU,kBAAkBR;YAAOE,eAAeA;;;AAGvD,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposeFeatureComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/LexicalEditor/ComposeFeatureComponent.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"ComposeFeatureComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/LexicalEditor/ComposeFeatureComponent.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,GAAI,OAAO,GAAG,4CAwBjD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../src/fields/LexicalEditor/feature.client.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../src/fields/LexicalEditor/feature.client.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,0BAA0B;;;;;;EAgBrC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/LexicalEditor/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { createClientFeature } from '@payloadcms/richtext-lexical/client'\nimport { TextNode } from 'lexical'\n\nimport { ComposeFeatureComponent } from './ComposeFeatureComponent.js'\n\nexport const LexicalEditorFeatureClient = createClientFeature((props) => {\n return {\n nodes: [TextNode],\n plugins: [\n {\n Component: ComposeFeatureComponent,\n position: 'belowContainer',\n },\n ],\n sanitizedClientFeatureProps: {\n field: props.field,\n path: props.field?.name,\n schemaPath: props.schemaPath,\n ...props?.props,\n },\n }\n})\n"],"names":["createClientFeature","TextNode","ComposeFeatureComponent","LexicalEditorFeatureClient","props","nodes","plugins","Component","position","sanitizedClientFeatureProps","field","path","name","schemaPath"],"mappings":"AAAA;AAEA,SAASA,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,QAAQ,QAAQ,UAAS;AAElC,SAASC,uBAAuB,QAAQ,+BAA8B;
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/LexicalEditor/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { createClientFeature } from '@payloadcms/richtext-lexical/client'\nimport { TextNode } from 'lexical'\n\nimport { ComposeFeatureComponent } from './ComposeFeatureComponent.js'\n\n\nexport const LexicalEditorFeatureClient = createClientFeature((props) => {\n return {\n nodes: [TextNode],\n plugins: [\n {\n Component: ComposeFeatureComponent,\n position: 'belowContainer',\n },\n ],\n sanitizedClientFeatureProps: {\n field: props.field,\n path: props.field?.name,\n schemaPath: props.schemaPath,\n ...props?.props,\n },\n }\n})\n"],"names":["createClientFeature","TextNode","ComposeFeatureComponent","LexicalEditorFeatureClient","props","nodes","plugins","Component","position","sanitizedClientFeatureProps","field","path","name","schemaPath"],"mappings":"AAAA;AAEA,SAASA,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,QAAQ,QAAQ,UAAS;AAElC,SAASC,uBAAuB,QAAQ,+BAA8B;AAGtE,OAAO,MAAMC,6BAA6BH,oBAAoB,CAACI;IAC7D,OAAO;QACLC,OAAO;YAACJ;SAAS;QACjBK,SAAS;YACP;gBACEC,WAAWL;gBACXM,UAAU;YACZ;SACD;QACDC,6BAA6B;YAC3BC,OAAON,MAAMM,KAAK;YAClBC,MAAMP,MAAMM,KAAK,EAAEE;YACnBC,YAAYT,MAAMS,UAAU;YAC5B,GAAGT,OAAOA,KAAK;QACjB;IACF;AACF,GAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../../../src/fields/SelectField/SelectField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAMnE,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../../../src/fields/SelectField/SelectField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAMnE,eAAO,MAAM,WAAW,GACtB,OAAO;IACL,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC7D,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,sBAAsB,4CAoC3B,CAAA"}
|
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAO9C,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAO9C,eAAO,MAAM,IAAI,GAAU,SAAS,OAAO,EAAE,qBAAgB,EAAE,cAAc,YAAY,kBAuFxF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteTextArea.d.ts","sourceRoot":"","sources":["../../../src/libraries/autocomplete/AutocompleteTextArea.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"AutocompleteTextArea.d.ts","sourceRoot":"","sources":["../../../src/libraries/autocomplete/AutocompleteTextArea.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,eAAO,MAAM,qBAAqB,GAAI,UAAK,4CAkgB1C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/libraries/handlebars/helpers.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/libraries/handlebars/helpers.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,oBAAoB,GAAI,YAAO,EAAE,eAAU,SAqBvD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replacePlaceholders.d.ts","sourceRoot":"","sources":["../../../src/libraries/handlebars/replacePlaceholders.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"replacePlaceholders.d.ts","sourceRoot":"","sources":["../../../src/libraries/handlebars/replacePlaceholders.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,QAEjE,CAAA"}
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAsC9C,QAAA,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAsC9C,QAAA,MAAM,eAAe,GAClB,cAAc,YAAY,MAC1B,gBAAgB,MAAM,KAAG,MA+FzB,CAAA;AAEH,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/FieldProvider/FieldProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAA;AAYvD,eAAO,MAAM,YAAY;WAThB,MAAM;iBACA,MAAM;WACZ,MAAM;EAO0C,CAAA;AAEzD,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"FieldProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/FieldProvider/FieldProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAA;AAYvD,eAAO,MAAM,YAAY;WAThB,MAAM;iBACA,MAAM;WACZ,MAAM;EAO0C,CAAA;AAEzD,eAAO,MAAM,aAAa,GAAI,wBAG3B;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAA;CAC9D,4CAwBA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInstructions.d.ts","sourceRoot":"","sources":["../../../src/providers/InstructionsProvider/useInstructions.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"useInstructions.d.ts","sourceRoot":"","sources":["../../../src/providers/InstructionsProvider/useInstructions.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe,GAC1B,SAAQ;IACN,UAAU,CAAC,EAAE,OAAO,CAAA;CAChB,QAgDP,CAAA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
1
|
+
import type { ClientField } from 'payload';
|
|
2
|
+
import { FC } from 'react';
|
|
3
3
|
type ComposeProps = {
|
|
4
|
-
descriptionProps?:
|
|
4
|
+
descriptionProps?: {
|
|
5
|
+
field: ClientField;
|
|
6
|
+
path: string;
|
|
7
|
+
schemaPath: string;
|
|
8
|
+
};
|
|
5
9
|
instructionId: string;
|
|
6
10
|
};
|
|
7
11
|
export declare const Compose: FC<ComposeProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Compose.d.ts","sourceRoot":"","sources":["../../../src/ui/Compose/Compose.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Compose.d.ts","sourceRoot":"","sources":["../../../src/ui/Compose/Compose.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAA;AA6BnC,KAAK,YAAY,GAAG;IAClB,gBAAgB,CAAC,EAAE;QACjB,KAAK,EAAE,WAAW,CAAA;QAClB,IAAI,EAAE,MAAM,CAAA;QACZ,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAgLpC,CAAA"}
|