@ai-stack/payloadcms 3.0.0-beta.104.4 → 3.0.0-beta.111.1
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/dist/ai/models/anthropic/generateRichText.d.ts.map +1 -1
- package/dist/ai/models/anthropic/generateRichText.js +2 -2
- package/dist/ai/models/anthropic/generateRichText.js.map +1 -1
- package/dist/ai/models/anthropic/index.d.ts.map +1 -1
- package/dist/ai/models/anthropic/index.js +0 -25
- package/dist/ai/models/anthropic/index.js.map +1 -1
- package/dist/ai/models/elevenLabs/index.js.map +1 -1
- package/dist/ai/models/openai/generateRichText.js +2 -2
- package/dist/ai/models/openai/generateRichText.js.map +1 -1
- package/dist/ai/models/openai/index.d.ts.map +1 -1
- package/dist/ai/models/openai/index.js +0 -27
- package/dist/ai/models/openai/index.js.map +1 -1
- package/dist/ai/prompts.js +1 -1
- package/dist/ai/prompts.js.map +1 -1
- package/dist/ai/schemas/lexicalJsonSchema.d.ts +2 -0
- package/dist/ai/schemas/lexicalJsonSchema.d.ts.map +1 -0
- package/dist/ai/schemas/lexicalJsonSchema.js +317 -0
- package/dist/ai/schemas/lexicalJsonSchema.js.map +1 -0
- package/dist/ai/utils/generateFileNameByPrompt.js.map +1 -1
- package/dist/ai/utils/systemGenerate.d.ts +5 -0
- package/dist/ai/utils/systemGenerate.d.ts.map +1 -0
- package/dist/ai/utils/{generateSeedPrompt.js → systemGenerate.js} +2 -2
- package/dist/ai/utils/systemGenerate.js.map +1 -0
- package/dist/collections/Instructions.d.ts +1 -1
- package/dist/collections/Instructions.d.ts.map +1 -1
- package/dist/collections/Instructions.js +177 -85
- package/dist/collections/Instructions.js.map +1 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.d.ts.map +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.js.map +1 -1
- package/dist/endpoints/fetchFields.d.ts +3 -0
- package/dist/endpoints/fetchFields.d.ts.map +1 -0
- package/dist/endpoints/fetchFields.js +21 -0
- package/dist/endpoints/fetchFields.js.map +1 -0
- package/dist/endpoints/index.d.ts.map +1 -1
- package/dist/endpoints/index.js +12 -17
- package/dist/endpoints/index.js.map +1 -1
- package/dist/fields/LexicalEditor/ComposeFeatureComponent.d.ts.map +1 -1
- package/dist/fields/LexicalEditor/ComposeFeatureComponent.js +1 -0
- package/dist/fields/LexicalEditor/ComposeFeatureComponent.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +11 -15
- package/dist/init.js.map +1 -1
- package/dist/libraries/autocomplete/AutocompleteTextArea.js.map +1 -1
- package/dist/libraries/handlebars/helpers.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +9 -34
- package/dist/plugin.js.map +1 -1
- package/dist/providers/InstructionsProvider/InstructionsProvider.d.ts.map +1 -1
- package/dist/providers/InstructionsProvider/InstructionsProvider.js +8 -6
- package/dist/providers/InstructionsProvider/InstructionsProvider.js.map +1 -1
- package/dist/providers/InstructionsProvider/useInstructions.js +1 -1
- package/dist/providers/InstructionsProvider/useInstructions.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/ui/Compose/Compose.d.ts.map +1 -1
- package/dist/ui/Compose/Compose.js +6 -4
- package/dist/ui/Compose/Compose.js.map +1 -1
- package/dist/ui/Compose/UndoRedoActions.js.map +1 -1
- package/dist/ui/Compose/hooks/menu/TranslateMenu.js.map +1 -1
- 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 +15 -16
- package/dist/ui/Compose/hooks/useGenerate.js.map +1 -1
- package/dist/ui/Compose/hooks/useHistory.js +1 -1
- package/dist/ui/Compose/hooks/useHistory.js.map +1 -1
- package/dist/utilities/updateFieldsConfig.d.ts.map +1 -1
- package/dist/utilities/updateFieldsConfig.js +6 -4
- package/dist/utilities/updateFieldsConfig.js.map +1 -1
- package/package.json +6 -9
- package/dist/ai/schemas/lexical.schema.d.ts +0 -31
- package/dist/ai/schemas/lexical.schema.d.ts.map +0 -1
- package/dist/ai/schemas/lexical.schema.js +0 -102
- package/dist/ai/schemas/lexical.schema.js.map +0 -1
- package/dist/ai/utils/generateSeedPrompt.d.ts +0 -5
- package/dist/ai/utils/generateSeedPrompt.d.ts.map +0 -1
- package/dist/ai/utils/generateSeedPrompt.js.map +0 -1
- package/dist/utilities/jsonToZod.d.ts +0 -3
- package/dist/utilities/jsonToZod.d.ts.map +0 -1
- package/dist/utilities/jsonToZod.js +0 -33
- package/dist/utilities/jsonToZod.js.map +0 -1
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
const CommonProperties = {
|
|
2
|
+
type: 'object',
|
|
3
|
+
properties: {
|
|
4
|
+
children: {
|
|
5
|
+
type: 'array',
|
|
6
|
+
items: {
|
|
7
|
+
$ref: '#/definitions/Node'
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
direction: {
|
|
11
|
+
type: [
|
|
12
|
+
'string',
|
|
13
|
+
'null'
|
|
14
|
+
],
|
|
15
|
+
enum: [
|
|
16
|
+
'ltr',
|
|
17
|
+
null
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
format: {
|
|
21
|
+
type: 'string'
|
|
22
|
+
},
|
|
23
|
+
indent: {
|
|
24
|
+
type: 'number'
|
|
25
|
+
},
|
|
26
|
+
version: {
|
|
27
|
+
type: 'number'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const BaseNode = {
|
|
32
|
+
type: 'object',
|
|
33
|
+
allOf: [
|
|
34
|
+
{
|
|
35
|
+
$ref: '#/definitions/CommonProperties'
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
properties: {
|
|
39
|
+
type: {
|
|
40
|
+
type: 'string'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
required: [
|
|
44
|
+
'type'
|
|
45
|
+
]
|
|
46
|
+
};
|
|
47
|
+
const CommonNodes = {
|
|
48
|
+
allOf: [
|
|
49
|
+
{
|
|
50
|
+
$ref: '#/definitions/BaseNode'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
properties: {
|
|
54
|
+
type: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
enum: [
|
|
57
|
+
'paragraph',
|
|
58
|
+
'quote',
|
|
59
|
+
'horizontalrule'
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
};
|
|
66
|
+
const HeadingNode = {
|
|
67
|
+
allOf: [
|
|
68
|
+
{
|
|
69
|
+
$ref: '#/definitions/BaseNode'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
properties: {
|
|
73
|
+
type: {
|
|
74
|
+
const: 'heading'
|
|
75
|
+
},
|
|
76
|
+
tag: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
enum: [
|
|
79
|
+
'h1',
|
|
80
|
+
'h2',
|
|
81
|
+
'h3',
|
|
82
|
+
'h4'
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
required: [
|
|
87
|
+
'tag'
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
const LinkNode = {
|
|
93
|
+
allOf: [
|
|
94
|
+
{
|
|
95
|
+
$ref: '#/definitions/BaseNode'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
properties: {
|
|
99
|
+
id: {
|
|
100
|
+
type: 'string'
|
|
101
|
+
},
|
|
102
|
+
type: {
|
|
103
|
+
const: 'link'
|
|
104
|
+
},
|
|
105
|
+
fields: {
|
|
106
|
+
type: 'object',
|
|
107
|
+
properties: {
|
|
108
|
+
linkType: {
|
|
109
|
+
type: 'string'
|
|
110
|
+
},
|
|
111
|
+
newTab: {
|
|
112
|
+
type: 'boolean'
|
|
113
|
+
},
|
|
114
|
+
url: {
|
|
115
|
+
type: 'string'
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
required: [
|
|
119
|
+
'linkType',
|
|
120
|
+
'newTab',
|
|
121
|
+
'url'
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
required: [
|
|
126
|
+
'id',
|
|
127
|
+
'fields'
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
};
|
|
132
|
+
const ListItemNode = {
|
|
133
|
+
allOf: [
|
|
134
|
+
{
|
|
135
|
+
$ref: '#/definitions/BaseNode'
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
properties: {
|
|
139
|
+
type: {
|
|
140
|
+
const: 'listitem'
|
|
141
|
+
},
|
|
142
|
+
checked: {
|
|
143
|
+
type: 'boolean'
|
|
144
|
+
},
|
|
145
|
+
value: {
|
|
146
|
+
type: 'number'
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
required: [
|
|
150
|
+
'value'
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
};
|
|
155
|
+
const ListNode = {
|
|
156
|
+
allOf: [
|
|
157
|
+
{
|
|
158
|
+
$ref: '#/definitions/BaseNode'
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
properties: {
|
|
162
|
+
type: {
|
|
163
|
+
const: 'list'
|
|
164
|
+
},
|
|
165
|
+
listType: {
|
|
166
|
+
type: 'string',
|
|
167
|
+
enum: [
|
|
168
|
+
'check',
|
|
169
|
+
'number',
|
|
170
|
+
'bullet'
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
start: {
|
|
174
|
+
type: 'number'
|
|
175
|
+
},
|
|
176
|
+
tag: {
|
|
177
|
+
type: 'string',
|
|
178
|
+
enum: [
|
|
179
|
+
'ul',
|
|
180
|
+
'ol'
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
required: [
|
|
185
|
+
'listType',
|
|
186
|
+
'start',
|
|
187
|
+
'tag'
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
};
|
|
192
|
+
// const MediaNode = {
|
|
193
|
+
// allOf: [
|
|
194
|
+
// { $ref: '#/definitions/BaseNode' },
|
|
195
|
+
// {
|
|
196
|
+
// properties: {
|
|
197
|
+
// type: { const: 'block' },
|
|
198
|
+
// fields: {
|
|
199
|
+
// type: 'object',
|
|
200
|
+
// properties: {
|
|
201
|
+
// id: { type: 'string' },
|
|
202
|
+
// blockName: { type: 'string' },
|
|
203
|
+
// blockType: { const: 'mediaBlock' },
|
|
204
|
+
// media: { type: 'string' },
|
|
205
|
+
// position: {
|
|
206
|
+
// type: 'string',
|
|
207
|
+
// enum: ['fullscreen', 'default'],
|
|
208
|
+
// },
|
|
209
|
+
// },
|
|
210
|
+
// required: ['id', 'media', 'position', 'blockName', 'blockType'],
|
|
211
|
+
// },
|
|
212
|
+
// version: { const: 2 },
|
|
213
|
+
// },
|
|
214
|
+
// required: ['version', 'fields'],
|
|
215
|
+
// },
|
|
216
|
+
// ],
|
|
217
|
+
// }
|
|
218
|
+
const Node = {
|
|
219
|
+
oneOf: [
|
|
220
|
+
{
|
|
221
|
+
$ref: '#/definitions/TextNode'
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
$ref: '#/definitions/LinkNode'
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
$ref: '#/definitions/ListItemNode'
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
$ref: '#/definitions/ListNode'
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
$ref: '#/definitions/HeadingNode'
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
$ref: '#/definitions/CommonNodes'
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
};
|
|
240
|
+
const RootNode = {
|
|
241
|
+
allOf: [
|
|
242
|
+
{
|
|
243
|
+
$ref: '#/definitions/BaseNode'
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
properties: {
|
|
247
|
+
type: {
|
|
248
|
+
const: 'root'
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
};
|
|
254
|
+
const TextNode = {
|
|
255
|
+
allOf: [
|
|
256
|
+
{
|
|
257
|
+
$ref: '#/definitions/BaseNode'
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
properties: {
|
|
261
|
+
type: {
|
|
262
|
+
const: 'text'
|
|
263
|
+
},
|
|
264
|
+
format: {
|
|
265
|
+
type: 'number'
|
|
266
|
+
},
|
|
267
|
+
text: {
|
|
268
|
+
type: 'string'
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
required: [
|
|
272
|
+
'text'
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
};
|
|
277
|
+
const baseJsonSchema = {
|
|
278
|
+
type: 'object',
|
|
279
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
280
|
+
definitions: {
|
|
281
|
+
BaseNode,
|
|
282
|
+
CommonNodes,
|
|
283
|
+
CommonProperties,
|
|
284
|
+
HeadingNode,
|
|
285
|
+
LinkNode,
|
|
286
|
+
ListItemNode,
|
|
287
|
+
ListNode,
|
|
288
|
+
// MediaNode,
|
|
289
|
+
Node,
|
|
290
|
+
RootNode,
|
|
291
|
+
TextNode
|
|
292
|
+
},
|
|
293
|
+
properties: {
|
|
294
|
+
root: {
|
|
295
|
+
$ref: '#/definitions/RootNode'
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
required: [
|
|
299
|
+
'root'
|
|
300
|
+
]
|
|
301
|
+
};
|
|
302
|
+
export const lexicalJsonSchema = (customNodes = [])=>{
|
|
303
|
+
const schema = JSON.parse(JSON.stringify(baseJsonSchema));
|
|
304
|
+
// Add custom nodes to the Node definition
|
|
305
|
+
if (customNodes.length > 0) {
|
|
306
|
+
customNodes.forEach((customNode, index)=>{
|
|
307
|
+
const customNodeName = `CustomNode${index + 1}`;
|
|
308
|
+
schema.definitions[customNodeName] = customNode;
|
|
309
|
+
schema.definitions.Node.oneOf.push({
|
|
310
|
+
$ref: `#/definitions/${customNodeName}`
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
return schema;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
//# sourceMappingURL=lexicalJsonSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ai/schemas/lexicalJsonSchema.ts"],"sourcesContent":["const CommonProperties = {\n type: 'object',\n properties: {\n children: {\n type: 'array',\n items: { $ref: '#/definitions/Node' },\n },\n direction: {\n type: ['string', 'null'],\n enum: ['ltr', null],\n },\n format: { type: 'string' },\n indent: { type: 'number' },\n version: { type: 'number' },\n },\n}\n\nconst BaseNode = {\n type: 'object',\n allOf: [{ $ref: '#/definitions/CommonProperties' }],\n properties: {\n type: { type: 'string' },\n },\n required: ['type'],\n}\n\nconst CommonNodes = {\n allOf: [\n { $ref: '#/definitions/BaseNode' },\n {\n properties: {\n type: {\n type: 'string',\n enum: ['paragraph', 'quote', 'horizontalrule'],\n },\n },\n },\n ],\n}\n\nconst HeadingNode = {\n allOf: [\n { $ref: '#/definitions/BaseNode' },\n {\n properties: {\n type: { const: 'heading' },\n tag: {\n type: 'string',\n enum: ['h1', 'h2', 'h3', 'h4'],\n },\n },\n required: ['tag'],\n },\n ],\n}\n\nconst LinkNode = {\n allOf: [\n { $ref: '#/definitions/BaseNode' },\n {\n properties: {\n id: { type: 'string' },\n type: { const: 'link' },\n fields: {\n type: 'object',\n properties: {\n linkType: { type: 'string' },\n newTab: { type: 'boolean' },\n url: { type: 'string' },\n },\n required: ['linkType', 'newTab', 'url'],\n },\n },\n required: ['id', 'fields'],\n },\n ],\n}\n\nconst ListItemNode = {\n allOf: [\n { $ref: '#/definitions/BaseNode' },\n {\n properties: {\n type: { const: 'listitem' },\n checked: { type: 'boolean' },\n value: { type: 'number' },\n },\n required: ['value'],\n },\n ],\n}\n\nconst ListNode = {\n allOf: [\n { $ref: '#/definitions/BaseNode' },\n {\n properties: {\n type: { const: 'list' },\n listType: {\n type: 'string',\n enum: ['check', 'number', 'bullet'],\n },\n start: { type: 'number' },\n tag: {\n type: 'string',\n enum: ['ul', 'ol'],\n },\n },\n required: ['listType', 'start', 'tag'],\n },\n ],\n}\n\n// const MediaNode = {\n// allOf: [\n// { $ref: '#/definitions/BaseNode' },\n// {\n// properties: {\n// type: { const: 'block' },\n// fields: {\n// type: 'object',\n// properties: {\n// id: { type: 'string' },\n// blockName: { type: 'string' },\n// blockType: { const: 'mediaBlock' },\n// media: { type: 'string' },\n// position: {\n// type: 'string',\n// enum: ['fullscreen', 'default'],\n// },\n// },\n// required: ['id', 'media', 'position', 'blockName', 'blockType'],\n// },\n// version: { const: 2 },\n// },\n// required: ['version', 'fields'],\n// },\n// ],\n// }\n\nconst Node = {\n oneOf: [\n { $ref: '#/definitions/TextNode' },\n { $ref: '#/definitions/LinkNode' },\n { $ref: '#/definitions/ListItemNode' },\n { $ref: '#/definitions/ListNode' },\n { $ref: '#/definitions/HeadingNode' },\n { $ref: '#/definitions/CommonNodes' },\n ],\n}\n\nconst RootNode = {\n allOf: [\n { $ref: '#/definitions/BaseNode' },\n {\n properties: {\n type: { const: 'root' },\n },\n },\n ],\n}\n\nconst TextNode = {\n allOf: [\n { $ref: '#/definitions/BaseNode' },\n {\n properties: {\n type: { const: 'text' },\n format: { type: 'number' },\n text: { type: 'string' },\n },\n required: ['text'],\n },\n ],\n}\n\nconst baseJsonSchema = {\n type: 'object',\n $schema: 'http://json-schema.org/draft-07/schema#',\n definitions: {\n BaseNode,\n CommonNodes,\n CommonProperties,\n HeadingNode,\n LinkNode,\n ListItemNode,\n ListNode,\n // MediaNode,\n Node,\n RootNode,\n TextNode,\n },\n properties: {\n root: { $ref: '#/definitions/RootNode' },\n },\n required: ['root'],\n}\n\nexport const lexicalJsonSchema = (customNodes = []) => {\n const schema = JSON.parse(JSON.stringify(baseJsonSchema))\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":["CommonProperties","type","properties","children","items","$ref","direction","enum","format","indent","version","BaseNode","allOf","required","CommonNodes","HeadingNode","const","tag","LinkNode","id","fields","linkType","newTab","url","ListItemNode","checked","value","ListNode","listType","start","Node","oneOf","RootNode","TextNode","text","baseJsonSchema","$schema","definitions","root","lexicalJsonSchema","customNodes","schema","JSON","parse","stringify","length","forEach","customNode","index","customNodeName","push"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/ai/utils/generateFileNameByPrompt.ts"],"sourcesContent":["export function generateFileNameByPrompt(prompt) {\n // Helper function to get a random integer between min and max (inclusive)\n function getRandomInt(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min\n }\n\n // Define the desired length of the filename part from the prompt\n const maxLength = 30\n const promptLength = prompt.length\n\n // Determine the start position for the random substring\n const startPos = getRandomInt(0, Math.max(0, promptLength - maxLength))\n\n // Get the random substring and truncate it if necessary\n let randomSubstring = prompt.substring(startPos, startPos + maxLength)\n\n // Replace invalid filename characters with an underscore\n randomSubstring = randomSubstring.replace(/[^a-z\\d]/gi, '_').toLowerCase()\n\n // Add a timestamp for uniqueness\n const timestamp = new Date().toISOString().replace(/[:.-]/g, '')\n\n // Combine the truncated prompt and timestamp to form the filename\n return `${randomSubstring}_${timestamp}`\n}\n"],"names":["generateFileNameByPrompt","prompt","getRandomInt","min","max","Math","floor","random","maxLength","promptLength","length","startPos","randomSubstring","substring","replace","toLowerCase","timestamp","Date","toISOString"],"mappings":"AAAA,OAAO,SAASA,yBAAyBC,MAAM;IAC7C,0EAA0E;IAC1E,SAASC,aAAaC,GAAG,EAAEC,GAAG;QAC5B,OAAOC,KAAKC,KAAK,CAACD,KAAKE,MAAM,KAAMH,CAAAA,MAAMD,MAAM,CAAA,KAAMA;IACvD;IAEA,iEAAiE;IACjE,MAAMK,YAAY;IAClB,MAAMC,eAAeR,OAAOS,MAAM;IAElC,wDAAwD;IACxD,MAAMC,WAAWT,aAAa,GAAGG,KAAKD,GAAG,CAAC,GAAGK,eAAeD;IAE5D,wDAAwD;IACxD,IAAII,kBAAkBX,OAAOY,SAAS,CAACF,UAAUA,WAAWH;IAE5D,yDAAyD;IACzDI,kBAAkBA,gBAAgBE,OAAO,CAAC,cAAc,KAAKC,WAAW;IAExE,iCAAiC;IACjC,MAAMC,YAAY,IAAIC,OAAOC,WAAW,GAAGJ,OAAO,CAAC,UAAU;IAE7D,kEAAkE;IAClE,OAAO,
|
|
1
|
+
{"version":3,"sources":["../../../src/ai/utils/generateFileNameByPrompt.ts"],"sourcesContent":["export function generateFileNameByPrompt(prompt) {\n // Helper function to get a random integer between min and max (inclusive)\n function getRandomInt(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min\n }\n\n // Define the desired length of the filename part from the prompt\n const maxLength = 30\n const promptLength = prompt.length\n\n // Determine the start position for the random substring\n const startPos = getRandomInt(0, Math.max(0, promptLength - maxLength))\n\n // Get the random substring and truncate it if necessary\n let randomSubstring = prompt.substring(startPos, startPos + maxLength)\n\n // Replace invalid filename characters with an underscore\n randomSubstring = randomSubstring.replace(/[^a-z\\d]/gi, '_').toLowerCase()\n\n // Add a timestamp for uniqueness\n const timestamp = new Date().toISOString().replace(/[:.-]/g, '')\n\n // Combine the truncated prompt and timestamp to form the filename\n return `${randomSubstring}_${timestamp}`\n}\n"],"names":["generateFileNameByPrompt","prompt","getRandomInt","min","max","Math","floor","random","maxLength","promptLength","length","startPos","randomSubstring","substring","replace","toLowerCase","timestamp","Date","toISOString"],"mappings":"AAAA,OAAO,SAASA,yBAAyBC,MAAM;IAC7C,0EAA0E;IAC1E,SAASC,aAAaC,GAAG,EAAEC,GAAG;QAC5B,OAAOC,KAAKC,KAAK,CAACD,KAAKE,MAAM,KAAMH,CAAAA,MAAMD,MAAM,CAAA,KAAMA;IACvD;IAEA,iEAAiE;IACjE,MAAMK,YAAY;IAClB,MAAMC,eAAeR,OAAOS,MAAM;IAElC,wDAAwD;IACxD,MAAMC,WAAWT,aAAa,GAAGG,KAAKD,GAAG,CAAC,GAAGK,eAAeD;IAE5D,wDAAwD;IACxD,IAAII,kBAAkBX,OAAOY,SAAS,CAACF,UAAUA,WAAWH;IAE5D,yDAAyD;IACzDI,kBAAkBA,gBAAgBE,OAAO,CAAC,cAAc,KAAKC,WAAW;IAExE,iCAAiC;IACjC,MAAMC,YAAY,IAAIC,OAAOC,WAAW,GAAGJ,OAAO,CAAC,UAAU;IAE7D,kEAAkE;IAClE,OAAO,GAAGF,gBAAgB,CAAC,EAAEI,WAAW;AAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemGenerate.d.ts","sourceRoot":"","sources":["../../../src/ai/utils/systemGenerate.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,SAAgB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,oBAmB5E,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { anthropic } from '@ai-sdk/anthropic';
|
|
|
2
2
|
import { openai } from '@ai-sdk/openai';
|
|
3
3
|
import { generateText } from 'ai';
|
|
4
4
|
import { PLUGIN_DEFAULT_ANTHROPIC_MODEL, PLUGIN_DEFAULT_OPENAI_MODEL } from '../../defaults.js';
|
|
5
|
-
export const
|
|
5
|
+
export const systemGenerate = async (data)=>{
|
|
6
6
|
const { prompt, system } = data;
|
|
7
7
|
let model = null;
|
|
8
8
|
if (process.env.OPENAI_API_KEY) {
|
|
@@ -20,4 +20,4 @@ export const generateSeedPrompt = async (data)=>{
|
|
|
20
20
|
return text;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=systemGenerate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ai/utils/systemGenerate.ts"],"sourcesContent":["import { anthropic } from '@ai-sdk/anthropic'\nimport { openai } from '@ai-sdk/openai'\nimport { generateText } from 'ai'\n\nimport { PLUGIN_DEFAULT_ANTHROPIC_MODEL, PLUGIN_DEFAULT_OPENAI_MODEL } from '../../defaults.js'\n\nexport const systemGenerate = async (data: { prompt: string; system: string }) => {\n const { prompt, system } = data\n let model = null\n\n if (process.env.OPENAI_API_KEY) {\n model = openai(PLUGIN_DEFAULT_OPENAI_MODEL)\n } else if (process.env.ANTHROPIC_API_KEY) {\n model = anthropic(PLUGIN_DEFAULT_ANTHROPIC_MODEL)\n } else {\n throw new Error('- AI Plugin: Please check your environment variables!')\n }\n\n const { text } = await generateText({\n model,\n prompt,\n system,\n })\n\n return text\n}\n"],"names":["anthropic","openai","generateText","PLUGIN_DEFAULT_ANTHROPIC_MODEL","PLUGIN_DEFAULT_OPENAI_MODEL","systemGenerate","data","prompt","system","model","process","env","OPENAI_API_KEY","ANTHROPIC_API_KEY","Error","text"],"mappings":"AAAA,SAASA,SAAS,QAAQ,oBAAmB;AAC7C,SAASC,MAAM,QAAQ,iBAAgB;AACvC,SAASC,YAAY,QAAQ,KAAI;AAEjC,SAASC,8BAA8B,EAAEC,2BAA2B,QAAQ,oBAAmB;AAE/F,OAAO,MAAMC,iBAAiB,OAAOC;IACnC,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAE,GAAGF;IAC3B,IAAIG,QAAQ;IAEZ,IAAIC,QAAQC,GAAG,CAACC,cAAc,EAAE;QAC9BH,QAAQR,OAAOG;IACjB,OAAO,IAAIM,QAAQC,GAAG,CAACE,iBAAiB,EAAE;QACxCJ,QAAQT,UAAUG;IACpB,OAAO;QACL,MAAM,IAAIW,MAAM;IAClB;IAEA,MAAM,EAAEC,IAAI,EAAE,GAAG,MAAMb,aAAa;QAClCO;QACAF;QACAC;IACF;IAEA,OAAOO;AACT,EAAC"}
|
|
@@ -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;
|
|
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,aAAc,OAAO,CAAC,gBAAgB,CAAC,KACvE,gBAoKA,CAAA"}
|
|
@@ -13,97 +13,189 @@ const modelOptions = GenerationModels.map((model)=>{
|
|
|
13
13
|
value: model.id
|
|
14
14
|
};
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
const defaultAccessConfig = {
|
|
17
|
+
create: ()=>true,
|
|
18
|
+
read: ()=>true,
|
|
19
|
+
update: ()=>true
|
|
20
|
+
};
|
|
21
|
+
const defaultAdminConfig = {
|
|
22
|
+
group: 'Plugins',
|
|
23
|
+
hidden: true
|
|
24
|
+
};
|
|
25
|
+
export const instructionsCollection = (options)=>({
|
|
26
|
+
slug: PLUGIN_INSTRUCTIONS_TABLE,
|
|
27
|
+
access: {
|
|
28
|
+
...defaultAccessConfig,
|
|
29
|
+
...options?.access
|
|
30
|
+
},
|
|
31
|
+
admin: {
|
|
32
|
+
...defaultAdminConfig,
|
|
33
|
+
...options?.admin,
|
|
34
|
+
group: 'Plugins'
|
|
35
35
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
fields: [
|
|
37
|
+
{
|
|
38
|
+
name: 'schema-path',
|
|
39
|
+
type: 'text',
|
|
40
|
+
admin: {
|
|
41
|
+
readOnly: true
|
|
42
|
+
},
|
|
43
|
+
unique: true
|
|
41
44
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
value: 'text'
|
|
45
|
+
{
|
|
46
|
+
name: 'field-type',
|
|
47
|
+
type: 'select',
|
|
48
|
+
admin: {
|
|
49
|
+
readOnly: true
|
|
48
50
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
defaultValue: 'text',
|
|
52
|
+
label: 'Field type',
|
|
53
|
+
options: [
|
|
54
|
+
{
|
|
55
|
+
label: 'text',
|
|
56
|
+
value: 'text'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: 'textarea',
|
|
60
|
+
value: 'textarea'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: 'upload',
|
|
64
|
+
value: 'upload'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: 'richText',
|
|
68
|
+
value: 'richText'
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'relation-to',
|
|
74
|
+
type: 'text',
|
|
75
|
+
admin: {
|
|
76
|
+
condition: (_, current)=>{
|
|
77
|
+
return current['field-type'] === 'upload';
|
|
78
|
+
}
|
|
52
79
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
80
|
+
label: 'Relation to'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'model-id',
|
|
84
|
+
type: 'select',
|
|
85
|
+
admin: {
|
|
86
|
+
components: {
|
|
87
|
+
Field: {
|
|
88
|
+
clientProps: {
|
|
89
|
+
filterByField: 'field-type',
|
|
90
|
+
options: modelOptions
|
|
91
|
+
},
|
|
92
|
+
path: '@ai-stack/payloadcms/fields#SelectField'
|
|
93
|
+
}
|
|
94
|
+
}
|
|
56
95
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
96
|
+
label: 'Model',
|
|
97
|
+
options: modelOptions.map((option)=>{
|
|
98
|
+
return {
|
|
99
|
+
label: option.label,
|
|
100
|
+
value: option.value
|
|
101
|
+
};
|
|
102
|
+
})
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'ai-prompts-tabs',
|
|
106
|
+
type: 'tabs',
|
|
107
|
+
tabs: [
|
|
108
|
+
{
|
|
109
|
+
description: 'This will appear within the tab above the fields.',
|
|
110
|
+
fields: [
|
|
111
|
+
{
|
|
112
|
+
name: 'prompt',
|
|
113
|
+
type: 'textarea',
|
|
114
|
+
admin: {
|
|
115
|
+
components: {
|
|
116
|
+
Field: '@ai-stack/payloadcms/fields#PromptEditorField'
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
label: ''
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
label: 'Prompt'
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
description: 'This will appear within the tab above the fields. sys',
|
|
126
|
+
fields: [
|
|
127
|
+
{
|
|
128
|
+
name: 'system',
|
|
129
|
+
type: 'textarea',
|
|
130
|
+
admin: {
|
|
131
|
+
condition: (_, current)=>{
|
|
132
|
+
return current['field-type'] === 'richText';
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
defaultValue: `INSTRUCTIONS:
|
|
136
|
+
You are a highly skilled and professional blog writer,
|
|
137
|
+
renowned for crafting engaging and well-organized articles.
|
|
138
|
+
When given a title, you meticulously create blogs that are not only
|
|
139
|
+
informative and accurate but also captivating and beautifully structured.`,
|
|
140
|
+
label: ''
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
label: 'System prompt'
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
// Note: Update when tabs PR is merged: https://github.com/payloadcms/payload/pull/8406
|
|
147
|
+
// admin: {
|
|
148
|
+
// condition: (_, current) => {
|
|
149
|
+
// console.log('condition in tab', current)
|
|
150
|
+
// return current['field-type'] === 'richText'
|
|
151
|
+
// },
|
|
152
|
+
// },
|
|
153
|
+
// Note: Update when tabs PR is merged: https://github.com/payloadcms/payload/pull/8406
|
|
154
|
+
// admin: {
|
|
155
|
+
// condition: (_, current) => {
|
|
156
|
+
// console.log('condition in tab', current)
|
|
157
|
+
// return current['field-type'] === 'richText'
|
|
158
|
+
// },
|
|
159
|
+
// },
|
|
160
|
+
description: 'This will appear within the tab above the fields. Layout',
|
|
161
|
+
fields: [
|
|
162
|
+
{
|
|
163
|
+
/**TODO's:
|
|
164
|
+
* - Layouts can be saved in as an array
|
|
165
|
+
* - user can add their own layout to collections and use it later for generate specific rich text
|
|
166
|
+
* - user can select previously added layout
|
|
167
|
+
*/ /**TODO's:
|
|
168
|
+
* - Layouts can be saved in as an array
|
|
169
|
+
* - user can add their own layout to collections and use it later for generate specific rich text
|
|
170
|
+
* - user can select previously added layout
|
|
171
|
+
*/ name: 'layout',
|
|
172
|
+
type: 'textarea',
|
|
173
|
+
admin: {
|
|
174
|
+
condition: (_, current)=>{
|
|
175
|
+
return current['field-type'] === 'richText';
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
defaultValue: `[paragraph] - Write a concise introduction (2-3 sentences) that outlines the main topic.
|
|
179
|
+
[horizontalrule] - Insert a horizontal rule to separate the introduction from the main content.
|
|
180
|
+
[list] - Create a list with 3-5 items. Each list item should contain:
|
|
181
|
+
a. [heading] - A brief, descriptive heading (up to 5 words)
|
|
182
|
+
b. [paragraph] - A short explanation or elaboration (1-2 sentences)
|
|
183
|
+
[horizontalrule] - Insert another horizontal rule to separate the main content from the conclusion.
|
|
184
|
+
[paragraph] - Compose a brief conclusion (2-3 sentences) summarizing the key points.
|
|
185
|
+
[quote] - Include a relevant quote from a famous person, directly related to the topic. Format: "Quote text." - Author Name`,
|
|
186
|
+
label: ''
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
label: 'Layout'
|
|
74
190
|
}
|
|
75
|
-
|
|
191
|
+
]
|
|
76
192
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: 'prompt',
|
|
87
|
-
type: 'textarea',
|
|
88
|
-
admin: {
|
|
89
|
-
components: {
|
|
90
|
-
Field: '@ai-stack/payloadcms/fields#PromptEditorField'
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
...groupSettings
|
|
95
|
-
],
|
|
96
|
-
hooks: {
|
|
97
|
-
beforeChange: [
|
|
98
|
-
(req)=>{
|
|
99
|
-
if (req.data['openai-gpt-object-settings']?.layout?.length === 0) {
|
|
100
|
-
// TODO: why??
|
|
101
|
-
req.data['openai-gpt-object-settings'].layout = '';
|
|
102
|
-
}
|
|
103
|
-
return req.data;
|
|
104
|
-
}
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
};
|
|
193
|
+
...groupSettings
|
|
194
|
+
],
|
|
195
|
+
labels: {
|
|
196
|
+
plural: 'Compose Settings',
|
|
197
|
+
singular: 'Compose Setting'
|
|
198
|
+
}
|
|
199
|
+
});
|
|
108
200
|
|
|
109
201
|
//# sourceMappingURL=Instructions.js.map
|