@ai-stack/payloadcms 3.0.0-beta.95.1 → 3.2.1-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.
Files changed (194) hide show
  1. package/LICENSE.md +2 -2
  2. package/README.md +19 -17
  3. package/dist/ai/models/anthropic/generateRichText.d.ts.map +1 -1
  4. package/dist/ai/models/anthropic/generateRichText.js +2 -2
  5. package/dist/ai/models/anthropic/generateRichText.js.map +1 -1
  6. package/dist/ai/models/anthropic/index.d.ts.map +1 -1
  7. package/dist/ai/models/anthropic/index.js +8 -32
  8. package/dist/ai/models/anthropic/index.js.map +1 -1
  9. package/dist/ai/models/elevenLabs/generateVoice.d.ts +1 -1
  10. package/dist/ai/models/elevenLabs/index.d.ts.map +1 -1
  11. package/dist/ai/models/elevenLabs/index.js +4 -3
  12. package/dist/ai/models/elevenLabs/index.js.map +1 -1
  13. package/dist/ai/models/openai/generateImage.d.ts +1 -1
  14. package/dist/ai/models/openai/generateRichText.js +2 -2
  15. package/dist/ai/models/openai/generateRichText.js.map +1 -1
  16. package/dist/ai/models/openai/generateVoice.d.ts +1 -1
  17. package/dist/ai/models/openai/index.d.ts.map +1 -1
  18. package/dist/ai/models/openai/index.js +9 -35
  19. package/dist/ai/models/openai/index.js.map +1 -1
  20. package/dist/ai/prompts.d.ts +1 -1
  21. package/dist/ai/prompts.d.ts.map +1 -1
  22. package/dist/ai/prompts.js +6 -3
  23. package/dist/ai/prompts.js.map +1 -1
  24. package/dist/ai/schemas/lexicalJsonSchema.d.ts +2 -0
  25. package/dist/ai/schemas/lexicalJsonSchema.d.ts.map +1 -0
  26. package/dist/ai/schemas/lexicalJsonSchema.js +317 -0
  27. package/dist/ai/schemas/lexicalJsonSchema.js.map +1 -0
  28. package/dist/ai/utils/generateFileNameByPrompt.js.map +1 -1
  29. package/dist/ai/utils/systemGenerate.d.ts +5 -0
  30. package/dist/ai/utils/systemGenerate.d.ts.map +1 -0
  31. package/dist/ai/utils/{generateSeedPrompt.js → systemGenerate.js} +2 -2
  32. package/dist/ai/utils/systemGenerate.js.map +1 -0
  33. package/dist/collections/Instructions.d.ts +1 -1
  34. package/dist/collections/Instructions.d.ts.map +1 -1
  35. package/dist/collections/Instructions.js +177 -85
  36. package/dist/collections/Instructions.js.map +1 -1
  37. package/dist/defaults.d.ts +1 -1
  38. package/dist/defaults.d.ts.map +1 -1
  39. package/dist/defaults.js +1 -1
  40. package/dist/defaults.js.map +1 -1
  41. package/dist/endpoints/fetchFields.d.ts +3 -0
  42. package/dist/endpoints/fetchFields.d.ts.map +1 -0
  43. package/dist/endpoints/fetchFields.js +21 -0
  44. package/dist/endpoints/fetchFields.js.map +1 -0
  45. package/dist/endpoints/index.d.ts.map +1 -1
  46. package/dist/endpoints/index.js +12 -18
  47. package/dist/endpoints/index.js.map +1 -1
  48. package/dist/exports/client.d.ts +0 -1
  49. package/dist/exports/client.d.ts.map +1 -1
  50. package/dist/exports/client.js +0 -1
  51. package/dist/exports/client.js.map +1 -1
  52. package/dist/exports/fields.d.ts +2 -0
  53. package/dist/exports/fields.d.ts.map +1 -1
  54. package/dist/exports/fields.js +2 -0
  55. package/dist/exports/fields.js.map +1 -1
  56. package/dist/fields/ComposeField/ComposeField.d.ts +3 -0
  57. package/dist/fields/ComposeField/ComposeField.d.ts.map +1 -0
  58. package/dist/fields/ComposeField/ComposeField.js +24 -0
  59. package/dist/fields/ComposeField/ComposeField.js.map +1 -0
  60. package/dist/fields/LexicalEditor/ComposeFeatureComponent.d.ts +2 -0
  61. package/dist/fields/LexicalEditor/ComposeFeatureComponent.d.ts.map +1 -0
  62. package/dist/fields/LexicalEditor/ComposeFeatureComponent.js +28 -0
  63. package/dist/fields/LexicalEditor/ComposeFeatureComponent.js.map +1 -0
  64. package/dist/fields/LexicalEditor/feature.client.d.ts +4 -1
  65. package/dist/fields/LexicalEditor/feature.client.d.ts.map +1 -1
  66. package/dist/fields/LexicalEditor/feature.client.js +15 -7
  67. package/dist/fields/LexicalEditor/feature.client.js.map +1 -1
  68. package/dist/fields/PromptEditorField/PromptEditorField.d.ts +2 -2
  69. package/dist/fields/PromptEditorField/PromptEditorField.d.ts.map +1 -1
  70. package/dist/fields/PromptEditorField/PromptEditorField.js +4 -8
  71. package/dist/fields/PromptEditorField/PromptEditorField.js.map +1 -1
  72. package/dist/fields/SelectField/SelectField.d.ts +3 -2
  73. package/dist/fields/SelectField/SelectField.d.ts.map +1 -1
  74. package/dist/fields/SelectField/SelectField.js +2 -3
  75. package/dist/fields/SelectField/SelectField.js.map +1 -1
  76. package/dist/index.d.ts +1 -6
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +1 -6
  79. package/dist/index.js.map +1 -1
  80. package/dist/init.d.ts +2 -1
  81. package/dist/init.d.ts.map +1 -1
  82. package/dist/init.js +22 -21
  83. package/dist/init.js.map +1 -1
  84. package/dist/libraries/autocomplete/AutocompleteTextArea.js +9 -7
  85. package/dist/libraries/autocomplete/AutocompleteTextArea.js.map +1 -1
  86. package/dist/libraries/handlebars/asyncHandlebars.js +1 -1
  87. package/dist/libraries/handlebars/asyncHandlebars.js.map +1 -1
  88. package/dist/libraries/handlebars/helpers.js.map +1 -1
  89. package/dist/plugin.d.ts.map +1 -1
  90. package/dist/plugin.js +30 -41
  91. package/dist/plugin.js.map +1 -1
  92. package/dist/providers/FieldProvider/FieldProvider.d.ts +15 -0
  93. package/dist/providers/FieldProvider/FieldProvider.d.ts.map +1 -0
  94. package/dist/providers/FieldProvider/FieldProvider.js +33 -0
  95. package/dist/providers/FieldProvider/FieldProvider.js.map +1 -0
  96. package/dist/providers/FieldProvider/useFieldProps.d.ts +6 -0
  97. package/dist/providers/FieldProvider/useFieldProps.d.ts.map +1 -0
  98. package/dist/providers/FieldProvider/useFieldProps.js +12 -0
  99. package/dist/providers/FieldProvider/useFieldProps.js.map +1 -0
  100. package/dist/providers/InstructionsProvider/InstructionsProvider.d.ts +5 -1
  101. package/dist/providers/InstructionsProvider/InstructionsProvider.d.ts.map +1 -1
  102. package/dist/providers/InstructionsProvider/InstructionsProvider.js +12 -7
  103. package/dist/providers/InstructionsProvider/InstructionsProvider.js.map +1 -1
  104. package/dist/providers/InstructionsProvider/useInstructions.d.ts +2 -2
  105. package/dist/providers/InstructionsProvider/useInstructions.d.ts.map +1 -1
  106. package/dist/providers/InstructionsProvider/useInstructions.js +17 -4
  107. package/dist/providers/InstructionsProvider/useInstructions.js.map +1 -1
  108. package/dist/types.d.ts +9 -41
  109. package/dist/types.d.ts.map +1 -1
  110. package/dist/types.js +1 -4
  111. package/dist/types.js.map +1 -1
  112. package/dist/ui/Compose/Compose.d.ts +9 -0
  113. package/dist/ui/Compose/Compose.d.ts.map +1 -0
  114. package/dist/ui/{Actions/Actions.js → Compose/Compose.js} +49 -39
  115. package/dist/ui/Compose/Compose.js.map +1 -0
  116. package/dist/ui/{Actions → Compose}/UndoRedoActions.d.ts.map +1 -1
  117. package/dist/ui/{Actions → Compose}/UndoRedoActions.js +15 -2
  118. package/dist/ui/Compose/UndoRedoActions.js.map +1 -0
  119. package/dist/ui/{Actions → Compose}/hooks/menu/Item.d.ts +1 -1
  120. package/dist/ui/{Actions → Compose}/hooks/menu/Item.d.ts.map +1 -1
  121. package/dist/ui/{Actions → Compose}/hooks/menu/Item.js +2 -2
  122. package/dist/ui/{Actions → Compose}/hooks/menu/Item.js.map +1 -1
  123. package/dist/ui/Compose/hooks/menu/TranslateMenu.d.ts.map +1 -0
  124. package/dist/ui/{Actions → Compose}/hooks/menu/TranslateMenu.js +11 -11
  125. package/dist/ui/Compose/hooks/menu/TranslateMenu.js.map +1 -0
  126. package/dist/ui/{Actions → Compose}/hooks/menu/items.d.ts +8 -8
  127. package/dist/ui/{Actions → Compose}/hooks/menu/items.d.ts.map +1 -1
  128. package/dist/ui/{Actions → Compose}/hooks/menu/items.js.map +1 -1
  129. package/dist/ui/{Actions → Compose}/hooks/menu/itemsMap.d.ts +1 -1
  130. package/dist/ui/Compose/hooks/menu/itemsMap.d.ts.map +1 -0
  131. package/dist/ui/{Actions → Compose}/hooks/menu/itemsMap.js +1 -2
  132. package/dist/ui/Compose/hooks/menu/itemsMap.js.map +1 -0
  133. package/dist/ui/Compose/hooks/menu/useMenu.d.ts.map +1 -0
  134. package/dist/ui/{Actions → Compose}/hooks/menu/useMenu.js +2 -1
  135. package/dist/ui/Compose/hooks/menu/useMenu.js.map +1 -0
  136. package/dist/ui/{Actions → Compose}/hooks/useGenerate.d.ts +3 -1
  137. package/dist/ui/Compose/hooks/useGenerate.d.ts.map +1 -0
  138. package/dist/ui/{Actions → Compose}/hooks/useGenerate.js +19 -24
  139. package/dist/ui/Compose/hooks/useGenerate.js.map +1 -0
  140. package/dist/ui/Compose/hooks/useHistory.d.ts.map +1 -0
  141. package/dist/ui/{Actions → Compose}/hooks/useHistory.js +6 -3
  142. package/dist/ui/Compose/hooks/useHistory.js.map +1 -0
  143. package/dist/utilities/setSafeLexicalState.d.ts +2 -2
  144. package/dist/utilities/setSafeLexicalState.d.ts.map +1 -1
  145. package/dist/utilities/setSafeLexicalState.js +5 -12
  146. package/dist/utilities/setSafeLexicalState.js.map +1 -1
  147. package/dist/utilities/updateFieldsConfig.d.ts.map +1 -1
  148. package/dist/utilities/updateFieldsConfig.js +18 -6
  149. package/dist/utilities/updateFieldsConfig.js.map +1 -1
  150. package/package.json +32 -37
  151. package/dist/ai/schemas/lexical.schema.d.ts +0 -31
  152. package/dist/ai/schemas/lexical.schema.d.ts.map +0 -1
  153. package/dist/ai/schemas/lexical.schema.js +0 -102
  154. package/dist/ai/schemas/lexical.schema.js.map +0 -1
  155. package/dist/ai/utils/generateSeedPrompt.d.ts +0 -5
  156. package/dist/ai/utils/generateSeedPrompt.d.ts.map +0 -1
  157. package/dist/ai/utils/generateSeedPrompt.js.map +0 -1
  158. package/dist/fields/DescriptionField/DescriptionField.d.ts +0 -2
  159. package/dist/fields/DescriptionField/DescriptionField.d.ts.map +0 -1
  160. package/dist/fields/DescriptionField/DescriptionField.js +0 -16
  161. package/dist/fields/DescriptionField/DescriptionField.js.map +0 -1
  162. package/dist/fields/DescriptionField/DescriptionFieldComponent.d.ts +0 -3
  163. package/dist/fields/DescriptionField/DescriptionFieldComponent.d.ts.map +0 -1
  164. package/dist/fields/DescriptionField/DescriptionFieldComponent.js +0 -19
  165. package/dist/fields/DescriptionField/DescriptionFieldComponent.js.map +0 -1
  166. package/dist/fields/LexicalEditor/ActionsFeatureComponent.d.ts +0 -2
  167. package/dist/fields/LexicalEditor/ActionsFeatureComponent.d.ts.map +0 -1
  168. package/dist/fields/LexicalEditor/ActionsFeatureComponent.js +0 -15
  169. package/dist/fields/LexicalEditor/ActionsFeatureComponent.js.map +0 -1
  170. package/dist/ui/Actions/Actions.d.ts +0 -5
  171. package/dist/ui/Actions/Actions.d.ts.map +0 -1
  172. package/dist/ui/Actions/Actions.js.map +0 -1
  173. package/dist/ui/Actions/UndoRedoActions.js.map +0 -1
  174. package/dist/ui/Actions/hooks/menu/TranslateMenu.d.ts.map +0 -1
  175. package/dist/ui/Actions/hooks/menu/TranslateMenu.js.map +0 -1
  176. package/dist/ui/Actions/hooks/menu/itemsMap.d.ts.map +0 -1
  177. package/dist/ui/Actions/hooks/menu/itemsMap.js.map +0 -1
  178. package/dist/ui/Actions/hooks/menu/useMenu.d.ts.map +0 -1
  179. package/dist/ui/Actions/hooks/menu/useMenu.js.map +0 -1
  180. package/dist/ui/Actions/hooks/useGenerate.d.ts.map +0 -1
  181. package/dist/ui/Actions/hooks/useGenerate.js.map +0 -1
  182. package/dist/ui/Actions/hooks/useHistory.d.ts.map +0 -1
  183. package/dist/ui/Actions/hooks/useHistory.js.map +0 -1
  184. package/dist/utilities/jsonToZod.d.ts +0 -3
  185. package/dist/utilities/jsonToZod.d.ts.map +0 -1
  186. package/dist/utilities/jsonToZod.js +0 -33
  187. package/dist/utilities/jsonToZod.js.map +0 -1
  188. /package/dist/ui/{Actions → Compose}/UndoRedoActions.d.ts +0 -0
  189. /package/dist/ui/{Actions/actions.module.scss → Compose/compose.module.scss} +0 -0
  190. /package/dist/ui/{Actions → Compose}/hooks/menu/TranslateMenu.d.ts +0 -0
  191. /package/dist/ui/{Actions → Compose}/hooks/menu/items.js +0 -0
  192. /package/dist/ui/{Actions → Compose}/hooks/menu/menu.module.scss +0 -0
  193. /package/dist/ui/{Actions → Compose}/hooks/menu/useMenu.d.ts +0 -0
  194. /package/dist/ui/{Actions → Compose}/hooks/useHistory.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ai/prompts.ts"],"sourcesContent":["import type { ActionMenuItems } from '../types.js'\n\ntype ActionPromptOptions = {\n layout?: string\n locale?: string\n prompt?: string\n systemPrompt?: string\n}\n\ntype ActionPrompt = {\n layout?: (options?: ActionPromptOptions) => string\n name: ActionMenuItems\n system: (options: ActionPromptOptions) => string\n}\n\nexport const defaultSystemPrompt = `\nIMPORTANT: JUST PRODUCE THE OUTPUT WITHOUT QUOTES AND DO NOT ENGAGE!\n`\n\nexport const defaultPrompts: ActionPrompt[] = [\n {\n name: 'Rephrase',\n system: ({\n prompt = '',\n systemPrompt = '',\n }) => `You are a skilled language expert. Rephrase the given text while maintaining its original meaning, tone, and emotional content. Use different words and sentence structures where possible, but preserve the overall style and sentiment of the original.\n \n -------------\n INSTRUCTIONS:\n - Rephrase the text according to the guidelines of the ORIGINAL SYSTEM PROMPT, if provided.\n - Retain the original meaning, tone, and emotional content.\n - Use different vocabulary and sentence structures where appropriate.\n - Ensure the rephrased text conveys the same message and feeling as the original.\n ${prompt ? '\\n\\nPrevious prompt:\\n' + prompt : ''}\n ${systemPrompt ? '\\n\\nORIGINAL SYSTEM PROMPT:\\n' + systemPrompt : ''}\n -------------`,\n },\n {\n name: 'Expand',\n system:\n () => `You are a creative writer and subject matter expert. Expand the given text by adding depth, detail, and relevant information while maintaining the original tone and style.\n \n -------------\n INSTRUCTIONS:\n - Understand the main ideas and tone of the text.\n - Add more details, examples, explanations, or context.\n - Maintain the original tone, style, and intent.\n - Ensure the expanded version flows naturally and coherently.\n - Do not contradict or alter the original meaning.\n -------------`,\n },\n {\n name: 'Proofread',\n system:\n () => `You are an English language expert. Proofread the given text, focusing on correcting grammar and spelling mistakes without altering the content, style, or tone.\n \n -------------\n INSTRUCTIONS:\n - Correct grammar and spelling errors.\n - Do not change the content, meaning, tone, or style.\n - Return the full text, whether corrections were made or not.\n - Do not provide additional comments or analysis.\n -------------`,\n },\n {\n name: 'Simplify',\n system: ({\n prompt = '',\n }) => `You are a skilled communicator specializing in clear and concise writing. Simplify the given text to make it easier to understand while retaining its core message.\n \n -------------\n INSTRUCTIONS:\n - Simplify the language, using more common words and shorter sentences.\n - Remove unnecessary details or jargon while keeping essential information.\n - Maintain the original meaning and key points.\n - Aim for clarity and readability for a general audience.\n - The simplified text should be more concise than the original.\n ${prompt ? '\\n\\nPREVIOUS PROMPT:\\n' + prompt : ''}\n -------------`,\n },\n {\n name: 'Summarize',\n layout: () => `\n[heading] - Summary\n[paragraph] - Your summary goes here...\n `,\n system: () =>\n `You are an expert at summarizing information. Your task is to create a concise summary of the given text that captures its key points and essential details while preserving the original meaning.\n\nINSTRUCTIONS:\n1. Carefully read and analyze the provided text.\n2. Identify and extract the main ideas and crucial supporting details.\n3. Condense the information into a clear and coherent summary that maintains the core message.\n4. Preserve the original tone and intent of the text.\n5. Ensure your summary is approximately 25-30% of the original text length.\n6. Use clear and precise language, avoiding unnecessary jargon or complexity.\n`,\n },\n {\n name: 'Tone',\n system: () =>\n `You are a tone adjustment specialist. Modify the tone of the given text as specified while keeping the original message and content intact.\n \n -------------\n INSTRUCTIONS:\n - Adjust the tone to match the specified style (e.g., formal, informal, professional, friendly).\n - Maintain the original content and meaning.\n - Ensure the adjusted text flows naturally with the new tone.\n -------------`,\n },\n {\n name: 'Translate',\n system: ({ locale, prompt = '', systemPrompt = '' }) =>\n `You are a skilled translator. Translate the following text into ${locale}, ensuring the original meaning, tone, and context are preserved.\n \n -------------\n INSTRUCTIONS:\n - Accurately translate the text into ${locale}.\n - Preserve the original meaning, tone, and context.\n - Ensure the translation is culturally appropriate and natural in the target language.\n ${prompt ? '\\n\\nPREVIOUS PROMPT:\\n' + prompt : ''}\n ${systemPrompt ? '\\n\\nORIGINAL SYSTEM PROMPT:\\n' + systemPrompt : ''}\n -------------`,\n },\n]\n\nexport const seedPrompts = ({ fieldLabel, fieldSchemaPaths, fieldType, path }) => {\n return {\n prompt: `field-type: ${fieldType}\nfield-name: ${fieldLabel}\nschema-path: ${path}\n\nGive me a prompt that relate to the given field type and schema path.\n\nGenerated prompt:\n`,\n system: `# AI Assistant for CMS Prompt Generation\n\nYour role: Generate prompts for Content Management System (CMS) fields based on field-type and schema-path.\n\n## Key Guidelines:\n- Tailor prompts to specific field-type and purpose\n- Use schema-path for context\n- Include '{{ title }}' in every prompt\n- Be clear, concise, and instructive\n- Focus on content generation, not user perspective\n- For Image, Voice, or Banner fields, use provided example prompts verbatim\n- Image, Banner prompt MUST NOT CONTAIN ANY TYPOGRAPHY/TEXT DETAILS\n\n## Field Types and Prompts:\n\n1. richText:\n - Craft detailed, structured content\n - Include intro, sections, body, formatting, and conclusion\n - Aim for engaging, informative, and valuable content\n\n2. text:\n - For titles: Generate concise, engaging titles\n - For keywords: List relevant SEO terms\n\n3. textarea:\n - Provide comprehensive details (e.g., event information)\n\n4. upload:\n - Describe high-quality images or media\n\n## Schema-path Examples:\n- posts.title: Blog/article title\n- products.name: Product name\n\n## Must Follow:\n- Adapt prompts to schema-path context\n- Generate content directly, avoid personal pronouns\n- Use provided examples as guidelines\n\n### Examples for each field type along with generated prompt:\n\nFor richText:\n field-type: richText\n field-name: Content\n schema-path: posts.content\n Generated prompt: Craft compelling content for a blog post with the title \"{{ title }}\". Develop a well-structured narrative that captivates readers from start to finish. Incorporate the following elements to create a polished and engaging piece:\n\n- Engaging introduction that hooks the reader\n- Clearly defined sections with relevant subheadings\n- Well-researched and informative body paragraphs\n- Creative use of formatting to enhance readability (e.g., bullet points, blockquotes, italics, headings, bolds, other text formats)\n- Compelling conclusion that reinforces the main theme\n- Make the format easily digestible and clear for enhanced readability and improved CTR. \n- The user should be engaged, consistently interested, and feel that they’ve gained the knowledge they were seeking. \n\nInfuse the content with your expertise and a touch of personality to make it both informative and enjoyable to read. Aim to provide value to your target audience while maintaining a professional tone that aligns with the blog's overall style.\nFeel free to incorporate relevant anecdotes, statistics, or examples to support your points and add depth to the post. Remember, the goal is to create content that not only informs but also inspires and entertains your readers.\n\nFor text:\n field-type: text\n field-name: title\n schema-path: posts.title\n Generated prompt: Generate a captivating title for the blog post based on '{{ title }}' that effectively encapsulates the main theme and draws in readers. The title should be concise, engaging, and relevant to the content being presented. If no input is provided then generate creative title.\n\nFor text:\n field-type: text\n field-name: keywords\n schema-path: posts.keywords\n Generated prompt: Identify and list relevant keywords for the blog post titled \"{{ title }}\". Focus on terms that enhance search engine optimization and accurately reflect the main themes and topics of the content.\nkeywords will with comma separated.\n\n\nFor textarea:\n field-type: textarea:\n field-name: details\n schema-path: posts.details\n Generated prompt: Provide comprehensive details for the event '{{ title }}'. Include essential information such as date, time, location, and any specific instructions or requirements.\n\nFor upload:\n field-type: upload\n field-name: Featured Image\n schema-path: posts.image\n Generated prompt: Imagine {{ title }}\n\nFor upload:\n field-type: upload\n field-name: Voice\n schema-path: posts.upload\n Generated prompt: {{ title }} {{ toLexicalHTML [provide schema-path for richText] }}\n\n\nRemember to adapt the prompts based on the specific schema-path provided, considering the context and purpose of the field within the CMS structure. The prompts should directly instruct the AI model on what content to generate or describe, without assuming a user perspective.\n\nSchema Map Context:\n${JSON.stringify(fieldSchemaPaths)}\n\n${defaultSystemPrompt}\n`,\n }\n}\n"],"names":["defaultSystemPrompt","defaultPrompts","name","system","prompt","systemPrompt","layout","locale","seedPrompts","fieldLabel","fieldSchemaPaths","fieldType","path","JSON","stringify"],"mappings":"AAeA,OAAO,MAAMA,sBAAsB,CAAC;;AAEpC,CAAC,CAAA;AAED,OAAO,MAAMC,iBAAiC;IAC5C;QACEC,MAAM;QAC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AAEU,KAAKC,SAAS,CAACJ,kBAAkB;;AAEnC,EAAEV,oBAAoB;AACtB,CAAC;IACC;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/ai/prompts.ts"],"sourcesContent":["import type { ActionMenuItems } from '../types.js'\n\ntype ActionPromptOptions = {\n layout?: string\n locale?: string\n prompt?: string\n systemPrompt?: string\n}\n\ntype ActionPrompt = {\n layout?: (options?: ActionPromptOptions) => string\n name: ActionMenuItems\n system: (options: ActionPromptOptions) => string\n}\n\n//TODO: This is a temporary solution make use of structured output\nexport const defaultSystemPrompt = `IMPORTANT INSTRUCTION:\nProduce only the requested output text.\nDo not add any explanations, comments, or engagement.\nDo not use quotation marks in the response.\nBEGIN OUTPUT:`\n\nexport const defaultPrompts: ActionPrompt[] = [\n {\n name: 'Rephrase',\n system: ({\n prompt = '',\n systemPrompt = '',\n }) => `You are a skilled language expert. Rephrase the given text while maintaining its original meaning, tone, and emotional content. Use different words and sentence structures where possible, but preserve the overall style and sentiment of the original.\n \n -------------\n INSTRUCTIONS:\n - Rephrase the text according to the guidelines of the ORIGINAL SYSTEM PROMPT, if provided.\n - Retain the original meaning, tone, and emotional content.\n - Use different vocabulary and sentence structures where appropriate.\n - Ensure the rephrased text conveys the same message and feeling as the original.\n ${prompt ? '\\n\\nPrevious prompt:\\n' + prompt : ''}\n ${systemPrompt ? '\\n\\nORIGINAL SYSTEM PROMPT:\\n' + systemPrompt : ''}\n -------------`,\n },\n {\n name: 'Expand',\n system:\n () => `You are a creative writer and subject matter expert. Expand the given text by adding depth, detail, and relevant information while maintaining the original tone and style.\n \n -------------\n INSTRUCTIONS:\n - Understand the main ideas and tone of the text.\n - Add more details, examples, explanations, or context.\n - Maintain the original tone, style, and intent.\n - Ensure the expanded version flows naturally and coherently.\n - Do not contradict or alter the original meaning.\n -------------`,\n },\n {\n name: 'Proofread',\n system:\n () => `You are an English language expert. Proofread the given text, focusing on correcting grammar and spelling mistakes without altering the content, style, or tone.\n \n -------------\n INSTRUCTIONS:\n - Correct grammar and spelling errors.\n - Do not change the content, meaning, tone, or style.\n - Return the full text, whether corrections were made or not.\n - Do not provide additional comments or analysis.\n -------------`,\n },\n {\n name: 'Simplify',\n system: ({\n prompt = '',\n }) => `You are a skilled communicator specializing in clear and concise writing. Simplify the given text to make it easier to understand while retaining its core message.\n \n -------------\n INSTRUCTIONS:\n - Simplify the language, using more common words and shorter sentences.\n - Remove unnecessary details or jargon while keeping essential information.\n - Maintain the original meaning and key points.\n - Aim for clarity and readability for a general audience.\n - The simplified text should be more concise than the original.\n ${prompt ? '\\n\\nPREVIOUS PROMPT:\\n' + prompt : ''}\n -------------`,\n },\n {\n name: 'Summarize',\n layout: () => `\n[heading] - Summary\n[paragraph] - Your summary goes here...\n `,\n system: () =>\n `You are an expert at summarizing information. Your task is to create a concise summary of the given text that captures its key points and essential details while preserving the original meaning.\n\nINSTRUCTIONS:\n1. Carefully read and analyze the provided text.\n2. Identify and extract the main ideas and crucial supporting details.\n3. Condense the information into a clear and coherent summary that maintains the core message.\n4. Preserve the original tone and intent of the text.\n5. Ensure your summary is approximately 25-30% of the original text length.\n6. Use clear and precise language, avoiding unnecessary jargon or complexity.\n`,\n },\n {\n name: 'Tone',\n system: () =>\n `You are a tone adjustment specialist. Modify the tone of the given text as specified while keeping the original message and content intact.\n \n -------------\n INSTRUCTIONS:\n - Adjust the tone to match the specified style (e.g., formal, informal, professional, friendly).\n - Maintain the original content and meaning.\n - Ensure the adjusted text flows naturally with the new tone.\n -------------`,\n },\n {\n name: 'Translate',\n system: ({ locale, prompt = '', systemPrompt = '' }) =>\n `You are a skilled translator. Translate the following text into ${locale}, ensuring the original meaning, tone, and context are preserved.\n \n -------------\n INSTRUCTIONS:\n - Accurately translate the text into ${locale}.\n - Preserve the original meaning, tone, and context.\n - Ensure the translation is culturally appropriate and natural in the target language.\n ${prompt ? '\\n\\nPREVIOUS PROMPT:\\n' + prompt : ''}\n ${systemPrompt ? '\\n\\nORIGINAL SYSTEM PROMPT:\\n' + systemPrompt : ''}\n -------------`,\n },\n]\n\nexport const seedPrompts = ({ fieldLabel, fieldSchemaPaths, fieldType, path }) => {\n return {\n prompt: `field-type: ${fieldType}\nfield-name: ${fieldLabel}\nschema-path: ${path}\n\nGive me a prompt that relate to the given field type and schema path.\n\nGenerated prompt:\n`,\n system: `# AI Assistant for CMS Prompt Generation\n\nYour role: Generate prompts for Content Management System (CMS) fields based on field-type and schema-path.\n\n## Key Guidelines:\n- Tailor prompts to specific field-type and purpose\n- Use schema-path for context\n- Include '{{ title }}' in every prompt\n- Be clear, concise, and instructive\n- Focus on content generation, not user perspective\n- For Image, Voice, or Banner fields, use provided example prompts verbatim\n- Image, Banner prompt MUST NOT CONTAIN ANY TYPOGRAPHY/TEXT DETAILS\n\n## Field Types and Prompts:\n\n1. richText:\n - Craft detailed, structured content\n - Include intro, sections, body, formatting, and conclusion\n - Aim for engaging, informative, and valuable content\n\n2. text:\n - For titles: Generate concise, engaging titles\n - For keywords: List relevant SEO terms\n\n3. textarea:\n - Provide comprehensive details (e.g., event information)\n\n4. upload:\n - Describe high-quality images or media\n\n## Schema-path Examples:\n- posts.title: Blog/article title\n- products.name: Product name\n\n## Must Follow:\n- Adapt prompts to schema-path context\n- Generate content directly, avoid personal pronouns\n- Use provided examples as guidelines\n\n### Examples for each field type along with generated prompt:\n\nFor richText:\n field-type: richText\n field-name: Content\n schema-path: posts.content\n Generated prompt: Craft compelling content for a blog post with the title \"{{ title }}\". Develop a well-structured narrative that captivates readers from start to finish. Incorporate the following elements to create a polished and engaging piece:\n\n- Engaging introduction that hooks the reader\n- Clearly defined sections with relevant subheadings\n- Well-researched and informative body paragraphs\n- Creative use of formatting to enhance readability (e.g., bullet points, blockquotes, italics, headings, bolds, other text formats)\n- Compelling conclusion that reinforces the main theme\n- Make the format easily digestible and clear for enhanced readability and improved CTR. \n- The user should be engaged, consistently interested, and feel that they’ve gained the knowledge they were seeking. \n\nInfuse the content with your expertise and a touch of personality to make it both informative and enjoyable to read. Aim to provide value to your target audience while maintaining a professional tone that aligns with the blog's overall style.\nFeel free to incorporate relevant anecdotes, statistics, or examples to support your points and add depth to the post. Remember, the goal is to create content that not only informs but also inspires and entertains your readers.\n\nFor text:\n field-type: text\n field-name: title\n schema-path: posts.title\n Generated prompt: Generate a captivating title for the blog post based on '{{ title }}' that effectively encapsulates the main theme and draws in readers. The title should be concise, engaging, and relevant to the content being presented. If no input is provided then generate creative title.\n\nFor text:\n field-type: text\n field-name: keywords\n schema-path: posts.keywords\n Generated prompt: Identify and list relevant keywords for the blog post titled \"{{ title }}\". Focus on terms that enhance search engine optimization and accurately reflect the main themes and topics of the content.\nkeywords will with comma separated.\n\n\nFor textarea:\n field-type: textarea:\n field-name: details\n schema-path: posts.details\n Generated prompt: Provide comprehensive details for the event '{{ title }}'. Include essential information such as date, time, location, and any specific instructions or requirements.\n\nFor upload:\n field-type: upload\n field-name: Featured Image\n schema-path: posts.image\n Generated prompt: Imagine {{ title }}\n\nFor upload:\n field-type: upload\n field-name: Voice\n schema-path: posts.upload\n Generated prompt: {{ title }} {{ toLexicalHTML [provide schema-path for richText] }}\n\n\nRemember to adapt the prompts based on the specific schema-path provided, considering the context and purpose of the field within the CMS structure. The prompts should directly instruct the AI model on what content to generate or describe, without assuming a user perspective.\n\nSchema Map Context:\n${JSON.stringify(fieldSchemaPaths)}\n\n${defaultSystemPrompt}\n`,\n }\n}\n"],"names":["defaultSystemPrompt","defaultPrompts","name","system","prompt","systemPrompt","layout","locale","seedPrompts","fieldLabel","fieldSchemaPaths","fieldType","path","JSON","stringify"],"mappings":"AAeA,kEAAkE;AAClE,OAAO,MAAMA,sBAAsB,CAAC;;;;aAIvB,CAAC,CAAA;AAEd,OAAO,MAAMC,iBAAiC;IAC5C;QACEC,MAAM;QACNC,QAAQ,CAAC,EACPC,SAAS,EAAE,EACXC,eAAe,EAAE,EAClB,GAAK,CAAC;;;;;;;;MAQL,EAAED,SAAS,2BAA2BA,SAAS,GAAG;MAClD,EAAEC,eAAe,k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any[]) => any;
2
+ //# sourceMappingURL=lexicalJsonSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexicalJsonSchema.d.ts","sourceRoot":"","sources":["../../../src/ai/schemas/lexicalJsonSchema.ts"],"names":[],"mappings":"AAsMA,eAAO,MAAM,iBAAiB,8BAa7B,CAAA"}
@@ -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":"AAAA,MAAMA,mBAAmB;IACvBC,MAAM;IACNC,YAAY;QACVC,UAAU;YACRF,MAAM;YACNG,OAAO;gBAAEC,MAAM;YAAqB;QACtC;QACAC,WAAW;YACTL,MAAM;gBAAC;gBAAU;aAAO;YACxBM,MAAM;gBAAC;gBAAO;aAAK;QACrB;QACAC,QAAQ;YAAEP,MAAM;QAAS;QACzBQ,QAAQ;YAAER,MAAM;QAAS;QACzBS,SAAS;YAAET,MAAM;QAAS;IAC5B;AACF;AAEA,MAAMU,WAAW;IACfV,MAAM;IACNW,OAAO;QAAC;YAAEP,MAAM;QAAiC;KAAE;IACnDH,YAAY;QACVD,MAAM;YAAEA,MAAM;QAAS;IACzB;IACAY,UAAU;QAAC;KAAO;AACpB;AAEA,MAAMC,cAAc;IAClBF,OAAO;QACL;YAAEP,MAAM;QAAyB;QACjC;YACEH,YAAY;gBACVD,MAAM;oBACJA,MAAM;oBACNM,MAAM;wBAAC;wBAAa;wBAAS;qBAAiB;gBAChD;YACF;QACF;KACD;AACH;AAEA,MAAMQ,cAAc;IAClBH,OAAO;QACL;YAAEP,MAAM;QAAyB;QACjC;YACEH,YAAY;gBACVD,MA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M,GAAG,GAAG;QAC1BL,YAAYM,OAAO,CAAC,CAACC,YAAYC;YAC/B,MAAMC,iBAAiB,CAAC,UAAU,EAAED,QAAQ,GAAG;YAC/CP,OAAOJ,WAAW,CAACY,eAAe,GAAGF;YACrCN,OAAOJ,WAAW,CAACP,IAAI,CAACC,KAAK,CAACmB,IAAI,CAAC;gBAAE7C,MAAM,CAAC,cAAc,EAAE4C,gBAAgB;YAAC;QAC/E;IACF;IAEA,OAAOR;AACT,EAAC"}
@@ -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,CAAC,EAAEF,gBAAgB,CAAC,EAAEI,UAAU,CAAC;AAC1C"}
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,5 @@
1
+ export declare const systemGenerate: (data: {
2
+ prompt: string;
3
+ system: string;
4
+ }) => Promise<string>;
5
+ //# sourceMappingURL=systemGenerate.d.ts.map
@@ -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 generateSeedPrompt = async (data)=>{
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=generateSeedPrompt.js.map
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,3 +1,3 @@
1
1
  import type { CollectionConfig } from 'payload';
2
- export declare const Instructions: CollectionConfig;
2
+ export declare const instructionsCollection: (options?: Partial<CollectionConfig>) => CollectionConfig;
3
3
  //# sourceMappingURL=Instructions.d.ts.map
@@ -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;AAoB3D,eAAO,MAAM,YAAY,EAAE,gBA4F1B,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"}