@ai-stack/payloadcms 3.68.0 → 3.76.0-beta.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.
Files changed (187) hide show
  1. package/dist/ai/core/media/image/generateImage.js +2 -6
  2. package/dist/ai/core/media/image/generateImage.js.map +1 -1
  3. package/dist/ai/core/media/image/handlers/multimodal.js +13 -28
  4. package/dist/ai/core/media/image/handlers/multimodal.js.map +1 -1
  5. package/dist/ai/core/media/image/handlers/standard.js +10 -7
  6. package/dist/ai/core/media/image/handlers/standard.js.map +1 -1
  7. package/dist/ai/core/media/speech/generateSpeech.js +8 -8
  8. package/dist/ai/core/media/speech/generateSpeech.js.map +1 -1
  9. package/dist/ai/core/media/types.d.ts +1 -1
  10. package/dist/ai/core/media/types.js.map +1 -1
  11. package/dist/ai/core/streamObject.js +3 -3
  12. package/dist/ai/core/streamObject.js.map +1 -1
  13. package/dist/ai/core/types.d.ts +3 -0
  14. package/dist/ai/core/types.js.map +1 -1
  15. package/dist/ai/prompts.d.ts +1 -2
  16. package/dist/ai/prompts.js +0 -110
  17. package/dist/ai/prompts.js.map +1 -1
  18. package/dist/ai/providers/blocks/anthropic.js +2 -1
  19. package/dist/ai/providers/blocks/anthropic.js.map +1 -1
  20. package/dist/ai/providers/blocks/elevenlabs.js +3 -2
  21. package/dist/ai/providers/blocks/elevenlabs.js.map +1 -1
  22. package/dist/ai/providers/blocks/fal.js +2 -1
  23. package/dist/ai/providers/blocks/fal.js.map +1 -1
  24. package/dist/ai/providers/blocks/google.js +12 -6
  25. package/dist/ai/providers/blocks/google.js.map +1 -1
  26. package/dist/ai/providers/blocks/openai-compatible.js +2 -1
  27. package/dist/ai/providers/blocks/openai-compatible.js.map +1 -1
  28. package/dist/ai/providers/blocks/openai.js +3 -2
  29. package/dist/ai/providers/blocks/openai.js.map +1 -1
  30. package/dist/ai/providers/blocks/xai.js +2 -1
  31. package/dist/ai/providers/blocks/xai.js.map +1 -1
  32. package/dist/ai/providers/icons.d.ts +7 -0
  33. package/dist/ai/providers/icons.js +9 -0
  34. package/dist/ai/providers/icons.js.map +1 -0
  35. package/dist/ai/providers/registry.js +36 -26
  36. package/dist/ai/providers/registry.js.map +1 -1
  37. package/dist/ai/utils/filterEditorSchemaByNodes.d.ts +9 -0
  38. package/dist/ai/utils/filterEditorSchemaByNodes.js +30 -3
  39. package/dist/ai/utils/filterEditorSchemaByNodes.js.map +1 -1
  40. package/dist/ai/utils/nodeToSchemaMap.d.ts +22 -0
  41. package/dist/ai/utils/nodeToSchemaMap.js +72 -0
  42. package/dist/ai/utils/nodeToSchemaMap.js.map +1 -0
  43. package/dist/collections/AIJobs.js +1 -1
  44. package/dist/collections/AIJobs.js.map +1 -1
  45. package/dist/collections/AIProviders.d.ts +2 -0
  46. package/dist/collections/{AISettings.js → AIProviders.js} +53 -25
  47. package/dist/collections/AIProviders.js.map +1 -0
  48. package/dist/collections/Instructions.js +45 -4
  49. package/dist/collections/Instructions.js.map +1 -1
  50. package/dist/defaults.d.ts +1 -0
  51. package/dist/defaults.js +8 -0
  52. package/dist/defaults.js.map +1 -1
  53. package/dist/endpoints/chat.d.ts +4 -0
  54. package/dist/endpoints/fetchFields.js +10 -0
  55. package/dist/endpoints/fetchFields.js.map +1 -1
  56. package/dist/endpoints/fetchVoices.js +42 -25
  57. package/dist/endpoints/fetchVoices.js.map +1 -1
  58. package/dist/endpoints/index.js +248 -35
  59. package/dist/endpoints/index.js.map +1 -1
  60. package/dist/exports/client.d.ts +1 -1
  61. package/dist/exports/client.js +1 -1
  62. package/dist/exports/client.js.map +1 -1
  63. package/dist/exports/fields.d.ts +1 -0
  64. package/dist/exports/fields.js +1 -0
  65. package/dist/exports/fields.js.map +1 -1
  66. package/dist/fields/ArrayComposeField/ArrayComposeField.d.ts +15 -0
  67. package/dist/fields/ArrayComposeField/ArrayComposeField.js +87 -0
  68. package/dist/fields/ArrayComposeField/ArrayComposeField.js.map +1 -0
  69. package/dist/fields/ArrayComposeField/ArrayComposeField.jsx +73 -0
  70. package/dist/fields/PromptEditorField/PromptEditorField.js +7 -2
  71. package/dist/fields/PromptEditorField/PromptEditorField.js.map +1 -1
  72. package/dist/fields/PromptEditorField/PromptEditorField.jsx +5 -2
  73. package/dist/index.d.ts +3 -1
  74. package/dist/index.js +2 -1
  75. package/dist/index.js.map +1 -1
  76. package/dist/payload-ai.d.ts +152 -0
  77. package/dist/plugin.js +18 -34
  78. package/dist/plugin.js.map +1 -1
  79. package/dist/providers/InstructionsProvider/InstructionsProvider.js +47 -15
  80. package/dist/providers/InstructionsProvider/InstructionsProvider.js.map +1 -1
  81. package/dist/providers/InstructionsProvider/InstructionsProvider.jsx +39 -16
  82. package/dist/providers/InstructionsProvider/context.d.ts +3 -0
  83. package/dist/providers/InstructionsProvider/context.js +2 -0
  84. package/dist/providers/InstructionsProvider/context.js.map +1 -1
  85. package/dist/providers/InstructionsProvider/useInstructions.js +22 -3
  86. package/dist/providers/InstructionsProvider/useInstructions.js.map +1 -1
  87. package/dist/styles.d.ts +11 -0
  88. package/dist/types/handlebars-async-helpers.d.ts +1 -0
  89. package/dist/types/handlebars-dist-handlebars.d.ts +1 -0
  90. package/dist/types/react-mentions.d.ts +1 -0
  91. package/dist/types.d.ts +36 -7
  92. package/dist/types.js +1 -0
  93. package/dist/types.js.map +1 -1
  94. package/dist/ui/AIConfigDashboard/index.d.ts +1 -1
  95. package/dist/ui/AIConfigDashboard/index.js +201 -23
  96. package/dist/ui/AIConfigDashboard/index.js.map +1 -1
  97. package/dist/ui/AIConfigDashboard/index.jsx +166 -15
  98. package/dist/ui/Compose/Compose.d.ts +1 -0
  99. package/dist/ui/Compose/Compose.js +23 -4
  100. package/dist/ui/Compose/Compose.js.map +1 -1
  101. package/dist/ui/Compose/Compose.jsx +23 -4
  102. package/dist/ui/Compose/UndoRedoActions.d.ts +2 -2
  103. package/dist/ui/Compose/UndoRedoActions.js +8 -5
  104. package/dist/ui/Compose/UndoRedoActions.js.map +1 -1
  105. package/dist/ui/Compose/UndoRedoActions.jsx +6 -5
  106. package/dist/ui/Compose/compose.module.css +56 -16
  107. package/dist/ui/Compose/hooks/menu/TranslateMenu.d.ts +5 -0
  108. package/dist/ui/Compose/hooks/menu/TranslateMenu.js +45 -4
  109. package/dist/ui/Compose/hooks/menu/TranslateMenu.js.map +1 -1
  110. package/dist/ui/Compose/hooks/menu/TranslateMenu.jsx +41 -5
  111. package/dist/ui/Compose/hooks/menu/itemsMap.js +12 -6
  112. package/dist/ui/Compose/hooks/menu/itemsMap.js.map +1 -1
  113. package/dist/ui/Compose/hooks/menu/menu.module.scss +4 -1
  114. package/dist/ui/Compose/hooks/menu/useMenu.js +26 -15
  115. package/dist/ui/Compose/hooks/menu/useMenu.js.map +1 -1
  116. package/dist/ui/Compose/hooks/menu/useMenu.jsx +25 -12
  117. package/dist/ui/Compose/hooks/useActiveFieldTracking.js +34 -0
  118. package/dist/ui/Compose/hooks/useActiveFieldTracking.js.map +1 -1
  119. package/dist/ui/Compose/hooks/useGenerate.js +26 -174
  120. package/dist/ui/Compose/hooks/useGenerate.js.map +1 -1
  121. package/dist/ui/Compose/hooks/useGenerateUpload.d.ts +11 -0
  122. package/dist/ui/Compose/hooks/useGenerateUpload.js +156 -0
  123. package/dist/ui/Compose/hooks/useGenerateUpload.js.map +1 -0
  124. package/dist/ui/Compose/hooks/useHistory.d.ts +0 -1
  125. package/dist/ui/Compose/hooks/useHistory.js +65 -25
  126. package/dist/ui/Compose/hooks/useHistory.js.map +1 -1
  127. package/dist/ui/Compose/hooks/useStreamingUpdate.d.ts +8 -0
  128. package/dist/ui/Compose/hooks/useStreamingUpdate.js +48 -0
  129. package/dist/ui/Compose/hooks/useStreamingUpdate.js.map +1 -0
  130. package/dist/ui/ConfigDashboard/index.d.ts +2 -0
  131. package/dist/ui/ConfigDashboard/index.js +224 -0
  132. package/dist/ui/ConfigDashboard/index.js.map +1 -0
  133. package/dist/ui/ConfigDashboard/index.jsx +175 -0
  134. package/dist/ui/DynamicModelSelect/index.js +1 -1
  135. package/dist/ui/DynamicModelSelect/index.js.map +1 -1
  136. package/dist/ui/DynamicModelSelect/index.jsx +1 -1
  137. package/dist/ui/DynamicProviderSelect/index.js +1 -1
  138. package/dist/ui/DynamicProviderSelect/index.js.map +1 -1
  139. package/dist/ui/DynamicProviderSelect/index.jsx +1 -1
  140. package/dist/ui/DynamicVoiceSelect/index.js +63 -11
  141. package/dist/ui/DynamicVoiceSelect/index.js.map +1 -1
  142. package/dist/ui/DynamicVoiceSelect/index.jsx +47 -14
  143. package/dist/ui/EncryptedTextField/index.js +4 -4
  144. package/dist/ui/EncryptedTextField/index.js.map +1 -1
  145. package/dist/ui/EncryptedTextField/index.jsx +4 -4
  146. package/dist/ui/ProviderOptionsEditor/index.js +1 -1
  147. package/dist/ui/ProviderOptionsEditor/index.js.map +1 -1
  148. package/dist/ui/ProviderOptionsEditor/index.jsx +1 -1
  149. package/dist/ui/VoicesFetcher/index.js +34 -16
  150. package/dist/ui/VoicesFetcher/index.js.map +1 -1
  151. package/dist/ui/VoicesFetcher/index.jsx +32 -15
  152. package/dist/utilities/buildSmartPrompt.d.ts +22 -0
  153. package/dist/utilities/buildSmartPrompt.js +141 -0
  154. package/dist/utilities/buildSmartPrompt.js.map +1 -0
  155. package/dist/utilities/encryption.js +2 -1
  156. package/dist/utilities/encryption.js.map +1 -1
  157. package/dist/utilities/fieldToJsonSchema.js +32 -3
  158. package/dist/utilities/fieldToJsonSchema.js.map +1 -1
  159. package/dist/utilities/resolveImageReferences.d.ts +3 -1
  160. package/dist/utilities/resolveImageReferences.js +21 -2
  161. package/dist/utilities/resolveImageReferences.js.map +1 -1
  162. package/dist/utilities/seedProperties.d.ts +7 -0
  163. package/dist/utilities/seedProperties.js +100 -0
  164. package/dist/utilities/seedProperties.js.map +1 -0
  165. package/dist/utilities/setSafeLexicalState.js +79 -6
  166. package/dist/utilities/setSafeLexicalState.js.map +1 -1
  167. package/dist/utilities/updateFieldsConfig.d.ts +1 -1
  168. package/dist/utilities/updateFieldsConfig.js +9 -2
  169. package/dist/utilities/updateFieldsConfig.js.map +1 -1
  170. package/package.json +35 -33
  171. package/dist/collections/AISettings.d.ts +0 -2
  172. package/dist/collections/AISettings.js.map +0 -1
  173. package/dist/endpoints/chat.d.js +0 -3
  174. package/dist/endpoints/chat.d.js.map +0 -1
  175. package/dist/init.d.ts +0 -7
  176. package/dist/init.js +0 -135
  177. package/dist/init.js.map +0 -1
  178. package/dist/payload-ai.d.js +0 -3
  179. package/dist/payload-ai.d.js.map +0 -1
  180. package/dist/styles.d.js +0 -2
  181. package/dist/styles.d.js.map +0 -1
  182. package/dist/types/handlebars-async-helpers.d.js +0 -2
  183. package/dist/types/handlebars-async-helpers.d.js.map +0 -1
  184. package/dist/types/handlebars-dist-handlebars.d.js +0 -2
  185. package/dist/types/handlebars-dist-handlebars.d.js.map +0 -1
  186. package/dist/types/react-mentions.d.js +0 -2
  187. package/dist/types/react-mentions.d.js.map +0 -1
@@ -6,7 +6,6 @@ import { generateStandardImage } from './handlers/standard.js';
6
6
  * Routes to appropriate handler based on model capabilities
7
7
  */ export async function generateImage(args) {
8
8
  const { model: modelId, payload, provider } = args;
9
- console.log('args: ', args.images);
10
9
  // Get provider registry and model configuration
11
10
  const registry = await getProviderRegistry(payload);
12
11
  const providerConfig = registry[provider || ''];
@@ -15,7 +14,8 @@ import { generateStandardImage } from './handlers/standard.js';
15
14
  }
16
15
  const modelConfig = providerConfig.models?.find((m)=>m.id === modelId);
17
16
  // Determine if this is a multimodal text-to-image model
18
- const isMultimodalText = modelConfig?.responseModalities?.includes('IMAGE') ?? false;
17
+ // It must support both TEXT and IMAGE modalities (or at least TEXT) to be treated as a language model
18
+ const isMultimodalText = modelConfig?.responseModalities?.includes('IMAGE') && modelConfig?.responseModalities?.includes('TEXT');
19
19
  // Merge provider's default image options with instruction-level overrides
20
20
  const mergedProviderOptions = {
21
21
  ...providerConfig.options?.image || {},
@@ -23,10 +23,6 @@ import { generateStandardImage } from './handlers/standard.js';
23
23
  };
24
24
  // Get appropriate model instance
25
25
  const model = await getImageModel(payload, provider, modelId, mergedProviderOptions, isMultimodalText);
26
- console.log('isMultimodalText : ', isMultimodalText);
27
- console.log('modelConfig : ', modelConfig);
28
- console.log('mergedProviderOptions : ', mergedProviderOptions);
29
- console.log('model : ', model);
30
26
  // Pass merged options to handlers
31
27
  const argsWithMergedOptions = {
32
28
  ...args,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/ai/core/media/image/generateImage.ts"],"sourcesContent":["import type { ImageModel, LanguageModel } from 'ai'\n\nimport type { ImageGenerationArgs, MediaResult } from '../types.js'\n\nimport { getImageModel, getProviderRegistry } from '../../../providers/registry.js'\nimport { generateMultimodalImage } from './handlers/multimodal.js'\nimport { generateStandardImage } from './handlers/standard.js'\n\n/**\n * Main image generation handler\n * Routes to appropriate handler based on model capabilities\n */\nexport async function generateImage(args: ImageGenerationArgs): Promise<MediaResult> {\n const { model: modelId, payload, provider } = args\n console.log('args: ', args.images)\n // Get provider registry and model configuration\n const registry = await getProviderRegistry(payload)\n const providerConfig = registry[provider || '']\n\n if (!providerConfig) {\n throw new Error(`Provider ${provider} not found in registry`)\n }\n\n const modelConfig = providerConfig.models?.find((m) => m.id === modelId)\n\n // Determine if this is a multimodal text-to-image model\n const isMultimodalText = modelConfig?.responseModalities?.includes('IMAGE') ?? false\n\n // Merge provider's default image options with instruction-level overrides\n const mergedProviderOptions = {\n ...(providerConfig.options?.image || {}),\n ...(args.providerOptions || {}),\n }\n\n // Get appropriate model instance\n const model = await getImageModel(\n payload,\n provider,\n modelId,\n mergedProviderOptions,\n isMultimodalText,\n )\n console.log('isMultimodalText : ', isMultimodalText)\n console.log('modelConfig : ', modelConfig)\n console.log('mergedProviderOptions : ', mergedProviderOptions)\n console.log('model : ', model)\n\n // Pass merged options to handlers\n const argsWithMergedOptions = { ...args, providerOptions: mergedProviderOptions }\n\n if (isMultimodalText) {\n return generateMultimodalImage(model as LanguageModel, argsWithMergedOptions)\n }\n\n return generateStandardImage(model as ImageModel, argsWithMergedOptions)\n}\n"],"names":["getImageModel","getProviderRegistry","generateMultimodalImage","generateStandardImage","generateImage","args","model","modelId","payload","provider","console","log","images","registry","providerConfig","Error","modelConfig","models","find","m","id","isMultimodalText","responseModalities","includes","mergedProviderOptions","options","image","providerOptions","argsWithMergedOptions"],"mappings":"AAIA,SAASA,aAAa,EAAEC,mBAAmB,QAAQ,iCAAgC;AACnF,SAASC,uBAAuB,QAAQ,2BAA0B;AAClE,SAASC,qBAAqB,QAAQ,yBAAwB;AAE9D;;;CAGC,GACD,OAAO,eAAeC,cAAcC,IAAyB;IAC3D,MAAM,EAAEC,OAAOC,OAAO,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGJ;IAC9CK,QAAQC,GAAG,CAAC,UAAUN,KAAKO,MAAM;IACjC,gDAAgD;IAChD,MAAMC,WAAW,MAAMZ,oBAAoBO;IAC3C,MAAMM,iBAAiBD,QAAQ,CAACJ,YAAY,GAAG;IAE/C,IAAI,CAACK,gBAAgB;QACnB,MAAM,IAAIC,MAAM,CAAC,SAAS,EAAEN,SAAS,sBAAsB,CAAC;IAC9D;IAEA,MAAMO,cAAcF,eAAeG,MAAM,EAAEC,KAAK,CAACC,IAAMA,EAAEC,EAAE,KAAKb;IAEhE,wDAAwD;IACxD,MAAMc,mBAAmBL,aAAaM,oBAAoBC,SAAS,YAAY;IAE/E,0EAA0E;IAC1E,MAAMC,wBAAwB;QAC5B,GAAIV,eAAeW,OAAO,EAAEC,SAAS,CAAC,CAAC;QACvC,GAAIrB,KAAKsB,eAAe,IAAI,CAAC,CAAC;IAChC;IAEA,iCAAiC;IACjC,MAAMrB,QAAQ,MAAMN,cAClBQ,SACAC,UACAF,SACAiB,uBACAH;IAEFX,QAAQC,GAAG,CAAC,uBAAuBU;IACnCX,QAAQC,GAAG,CAAC,kBAAkBK;IAC9BN,QAAQC,GAAG,CAAC,4BAA4Ba;IACxCd,QAAQC,GAAG,CAAC,YAAYL;IAExB,kCAAkC;IAClC,MAAMsB,wBAAwB;QAAE,GAAGvB,IAAI;QAAEsB,iBAAiBH;IAAsB;IAEhF,IAAIH,kBAAkB;QACpB,OAAOnB,wBAAwBI,OAAwBsB;IACzD;IAEA,OAAOzB,sBAAsBG,OAAqBsB;AACpD"}
1
+ {"version":3,"sources":["../../../../../src/ai/core/media/image/generateImage.ts"],"sourcesContent":["import type { ImageModel, LanguageModel } from 'ai'\n\nimport type { ImageGenerationArgs, MediaResult } from '../types.js'\n\nimport { getImageModel, getProviderRegistry } from '../../../providers/registry.js'\nimport { generateMultimodalImage } from './handlers/multimodal.js'\nimport { generateStandardImage } from './handlers/standard.js'\n\n/**\n * Main image generation handler\n * Routes to appropriate handler based on model capabilities\n */\nexport async function generateImage(args: ImageGenerationArgs): Promise<MediaResult> {\n const { model: modelId, payload, provider } = args\n // Get provider registry and model configuration\n const registry = await getProviderRegistry(payload)\n const providerConfig = registry[provider || '']\n\n if (!providerConfig) {\n throw new Error(`Provider ${provider} not found in registry`)\n }\n\n const modelConfig = providerConfig.models?.find((m) => m.id === modelId)\n\n // Determine if this is a multimodal text-to-image model\n // It must support both TEXT and IMAGE modalities (or at least TEXT) to be treated as a language model\n const isMultimodalText =\n modelConfig?.responseModalities?.includes('IMAGE') &&\n modelConfig?.responseModalities?.includes('TEXT')\n\n // Merge provider's default image options with instruction-level overrides\n const mergedProviderOptions = {\n ...(providerConfig.options?.image || {}),\n ...(args.providerOptions || {}),\n }\n\n // Get appropriate model instance\n const model = await getImageModel(\n payload,\n provider,\n modelId,\n mergedProviderOptions,\n isMultimodalText,\n )\n // Pass merged options to handlers\n const argsWithMergedOptions = { ...args, providerOptions: mergedProviderOptions }\n\n if (isMultimodalText) {\n return generateMultimodalImage(model as LanguageModel, argsWithMergedOptions)\n }\n\n return generateStandardImage(model as ImageModel, argsWithMergedOptions)\n}\n"],"names":["getImageModel","getProviderRegistry","generateMultimodalImage","generateStandardImage","generateImage","args","model","modelId","payload","provider","registry","providerConfig","Error","modelConfig","models","find","m","id","isMultimodalText","responseModalities","includes","mergedProviderOptions","options","image","providerOptions","argsWithMergedOptions"],"mappings":"AAIA,SAASA,aAAa,EAAEC,mBAAmB,QAAQ,iCAAgC;AACnF,SAASC,uBAAuB,QAAQ,2BAA0B;AAClE,SAASC,qBAAqB,QAAQ,yBAAwB;AAE9D;;;CAGC,GACD,OAAO,eAAeC,cAAcC,IAAyB;IAC3D,MAAM,EAAEC,OAAOC,OAAO,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGJ;IAC9C,gDAAgD;IAChD,MAAMK,WAAW,MAAMT,oBAAoBO;IAC3C,MAAMG,iBAAiBD,QAAQ,CAACD,YAAY,GAAG;IAE/C,IAAI,CAACE,gBAAgB;QACnB,MAAM,IAAIC,MAAM,CAAC,SAAS,EAAEH,SAAS,sBAAsB,CAAC;IAC9D;IAEA,MAAMI,cAAcF,eAAeG,MAAM,EAAEC,KAAK,CAACC,IAAMA,EAAEC,EAAE,KAAKV;IAEhE,wDAAwD;IACxD,sGAAsG;IACtG,MAAMW,mBACJL,aAAaM,oBAAoBC,SAAS,YAC1CP,aAAaM,oBAAoBC,SAAS;IAE5C,0EAA0E;IAC1E,MAAMC,wBAAwB;QAC5B,GAAIV,eAAeW,OAAO,EAAEC,SAAS,CAAC,CAAC;QACvC,GAAIlB,KAAKmB,eAAe,IAAI,CAAC,CAAC;IAChC;IAEA,iCAAiC;IACjC,MAAMlB,QAAQ,MAAMN,cAClBQ,SACAC,UACAF,SACAc,uBACAH;IAEF,kCAAkC;IAClC,MAAMO,wBAAwB;QAAE,GAAGpB,IAAI;QAAEmB,iBAAiBH;IAAsB;IAEhF,IAAIH,kBAAkB;QACpB,OAAOhB,wBAAwBI,OAAwBmB;IACzD;IAEA,OAAOtB,sBAAsBG,OAAqBmB;AACpD"}
@@ -5,19 +5,6 @@ import { convertToBuffer, getExtensionFromMimeType } from '../../utils.js';
5
5
  * Uses generateText with image response modalities
6
6
  */ export async function generateMultimodalImage(model, args) {
7
7
  const { images = [], prompt, providerOptions = {} } = args;
8
- //
9
- // const promptParts: ModelMessage[] = [
10
- // { role: 'user', content: [{ type: 'text', text: prompt } }],
11
- // ...,
12
- // ]
13
- //
14
- // const messages = [
15
- // {
16
- // content: promptParts,
17
- // role: 'user' as const,
18
- // },
19
- // ]
20
- console.log('providerOptions: ', providerOptions);
21
8
  // Build Google-specific options with required defaults
22
9
  const googleOptions = {
23
10
  imageConfig: {
@@ -56,10 +43,6 @@ import { convertToBuffer, getExtensionFromMimeType } from '../../utils.js';
56
43
  google: googleOptions
57
44
  }
58
45
  });
59
- // console.log("model -->", model)
60
- // console.log('result.files: ', result.files)
61
- // console.log('result.text: ', result.text)
62
- // console.log('result.response: ', JSON.stringify(result.response, null, 2))
63
46
  // Extract images from result.files
64
47
  const resultImages = result.files?.filter((f)=>f.mediaType?.startsWith('image/')) || [];
65
48
  if (resultImages.length === 0) {
@@ -74,21 +57,23 @@ import { convertToBuffer, getExtensionFromMimeType } from '../../utils.js';
74
57
  }
75
58
  throw new Error('No images returned from the model. The model may have generated only text.');
76
59
  }
77
- const firstImage = resultImages[0];
78
- const mimeType = firstImage.mediaType || 'image/png';
79
- const imageData = firstImage.base64Data || firstImage.uint8Array;
80
- if (!imageData) {
81
- throw new Error('Image data is missing from the response.');
82
- }
83
- const buffer = convertToBuffer(imageData);
84
- const extension = getExtensionFromMimeType(mimeType);
85
- return {
86
- file: {
60
+ const files = resultImages.map((image)=>{
61
+ const mimeType = image.mediaType || 'image/png';
62
+ const imageData = image.base64Data || image.uint8Array;
63
+ if (!imageData) {
64
+ throw new Error('Image data is missing from the response.');
65
+ }
66
+ const buffer = convertToBuffer(imageData);
67
+ const extension = getExtensionFromMimeType(mimeType);
68
+ return {
87
69
  name: `generated.${extension}`,
88
70
  data: buffer,
89
71
  mimetype: mimeType,
90
72
  size: buffer.byteLength
91
- }
73
+ };
74
+ });
75
+ return {
76
+ files
92
77
  };
93
78
  }
94
79
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/ai/core/media/image/handlers/multimodal.ts"],"sourcesContent":["import { generateText, type LanguageModel, ModelMessage } from 'ai'\n\nimport type { ImageGenerationArgs, MediaResult, MultimodalImageFile } from '../../types.js'\n\nimport { convertToBuffer, getExtensionFromMimeType } from '../../utils.js'\n\n/**\n * Handle multimodal text-to-image generation (e.g., Gemini Nano Banana)\n * Uses generateText with image response modalities\n */\nexport async function generateMultimodalImage(\n model: LanguageModel,\n args: ImageGenerationArgs,\n): Promise<MediaResult> {\n const { images = [], prompt, providerOptions = {} } = args\n //\n // const promptParts: ModelMessage[] = [\n // { role: 'user', content: [{ type: 'text', text: prompt } }],\n // ...,\n // ]\n //\n // const messages = [\n // {\n // content: promptParts,\n // role: 'user' as const,\n // },\n // ]\n\n console.log('providerOptions: ', providerOptions)\n \n // Build Google-specific options with required defaults\n const googleOptions = {\n imageConfig: {\n aspectRatio: args.aspectRatio || providerOptions?.aspectRatio || '16:9',\n ...(providerOptions?.personGeneration && { personGeneration: providerOptions.personGeneration }),\n ...(providerOptions?.addWatermark !== undefined && { addWatermark: providerOptions.addWatermark }),\n },\n responseModalities: ['IMAGE', 'TEXT'],\n }\n \n const result = await generateText({\n model,\n // onStepFinish: (step) => {\n // console.log('step finish: ', step.files)\n // console.log('step finish: ', step.response)\n // },\n prompt: [\n {\n content: [{ type: 'text', text: prompt }, ...images],\n role: 'user',\n },\n ],\n providerOptions: {\n google: googleOptions,\n },\n })\n\n // console.log(\"model -->\", model)\n // console.log('result.files: ', result.files)\n // console.log('result.text: ', result.text)\n // console.log('result.response: ', JSON.stringify(result.response, null, 2))\n\n // Extract images from result.files\n const resultImages = (result.files?.filter((f: MultimodalImageFile) =>\n f.mediaType?.startsWith('image/'),\n ) || []) as MultimodalImageFile[]\n\n if (resultImages.length === 0) {\n // Check if Google returned a specific error message\n const responseBody = result.response?.body as { candidates?: Array<{ finishMessage?: string; finishReason?: string }> } | undefined\n const candidate = responseBody?.candidates?.[0]\n \n if (candidate?.finishMessage) {\n throw new Error(`Image generation failed: ${candidate.finishMessage}`)\n }\n if (candidate?.finishReason && candidate.finishReason !== 'STOP') {\n throw new Error(`Image generation failed with reason: ${candidate.finishReason}`)\n }\n \n throw new Error('No images returned from the model. The model may have generated only text.')\n }\n\n const firstImage = resultImages[0]\n const mimeType = firstImage.mediaType || 'image/png'\n const imageData = firstImage.base64Data || firstImage.uint8Array\n\n if (!imageData) {\n throw new Error('Image data is missing from the response.')\n }\n\n const buffer = convertToBuffer(imageData)\n const extension = getExtensionFromMimeType(mimeType)\n\n return {\n file: {\n name: `generated.${extension}`,\n data: buffer,\n mimetype: mimeType,\n size: buffer.byteLength,\n },\n }\n}\n"],"names":["generateText","convertToBuffer","getExtensionFromMimeType","generateMultimodalImage","model","args","images","prompt","providerOptions","console","log","googleOptions","imageConfig","aspectRatio","personGeneration","addWatermark","undefined","responseModalities","result","content","type","text","role","google","resultImages","files","filter","f","mediaType","startsWith","length","responseBody","response","body","candidate","candidates","finishMessage","Error","finishReason","firstImage","mimeType","imageData","base64Data","uint8Array","buffer","extension","file","name","data","mimetype","size","byteLength"],"mappings":"AAAA,SAASA,YAAY,QAA0C,KAAI;AAInE,SAASC,eAAe,EAAEC,wBAAwB,QAAQ,iBAAgB;AAE1E;;;CAGC,GACD,OAAO,eAAeC,wBACpBC,KAAoB,EACpBC,IAAyB;IAEzB,MAAM,EAAEC,SAAS,EAAE,EAAEC,MAAM,EAAEC,kBAAkB,CAAC,CAAC,EAAE,GAAGH;IACtD,EAAE;IACF,wCAAwC;IACxC,iEAAiE;IACjE,SAAS;IACT,IAAI;IACJ,EAAE;IACF,qBAAqB;IACrB,MAAM;IACN,4BAA4B;IAC5B,6BAA6B;IAC7B,OAAO;IACP,IAAI;IAEJI,QAAQC,GAAG,CAAC,qBAAqBF;IAEjC,uDAAuD;IACvD,MAAMG,gBAAgB;QACpBC,aAAa;YACXC,aAAaR,KAAKQ,WAAW,IAAIL,iBAAiBK,eAAe;YACjE,GAAIL,iBAAiBM,oBAAoB;gBAAEA,kBAAkBN,gBAAgBM,gBAAgB;YAAC,CAAC;YAC/F,GAAIN,iBAAiBO,iBAAiBC,aAAa;gBAAED,cAAcP,gBAAgBO,YAAY;YAAC,CAAC;QACnG;QACAE,oBAAoB;YAAC;YAAS;SAAO;IACvC;IAEA,MAAMC,SAAS,MAAMlB,aAAa;QAChCI;QACA,4BAA4B;QAC5B,6CAA6C;QAC7C,gDAAgD;QAChD,KAAK;QACLG,QAAQ;YACN;gBACEY,SAAS;oBAAC;wBAAEC,MAAM;wBAAQC,MAAMd;oBAAO;uBAAMD;iBAAO;gBACpDgB,MAAM;YACR;SACD;QACDd,iBAAiB;YACfe,QAAQZ;QACV;IACF;IAEA,kCAAkC;IAClC,8CAA8C;IAC9C,4CAA4C;IAC5C,6EAA6E;IAE7E,mCAAmC;IACnC,MAAMa,eAAgBN,OAAOO,KAAK,EAAEC,OAAO,CAACC,IAC1CA,EAAEC,SAAS,EAAEC,WAAW,cACrB,EAAE;IAEP,IAAIL,aAAaM,MAAM,KAAK,GAAG;QAC7B,oDAAoD;QACpD,MAAMC,eAAeb,OAAOc,QAAQ,EAAEC;QACtC,MAAMC,YAAYH,cAAcI,YAAY,CAAC,EAAE;QAE/C,IAAID,WAAWE,eAAe;YAC5B,MAAM,IAAIC,MAAM,CAAC,yBAAyB,EAAEH,UAAUE,aAAa,CAAC,CAAC;QACvE;QACA,IAAIF,WAAWI,gBAAgBJ,UAAUI,YAAY,KAAK,QAAQ;YAChE,MAAM,IAAID,MAAM,CAAC,qCAAqC,EAAEH,UAAUI,YAAY,CAAC,CAAC;QAClF;QAEA,MAAM,IAAID,MAAM;IAClB;IAEA,MAAME,aAAaf,YAAY,CAAC,EAAE;IAClC,MAAMgB,WAAWD,WAAWX,SAAS,IAAI;IACzC,MAAMa,YAAYF,WAAWG,UAAU,IAAIH,WAAWI,UAAU;IAEhE,IAAI,CAACF,WAAW;QACd,MAAM,IAAIJ,MAAM;IAClB;IAEA,MAAMO,SAAS3C,gBAAgBwC;IAC/B,MAAMI,YAAY3C,yBAAyBsC;IAE3C,OAAO;QACLM,MAAM;YACJC,MAAM,CAAC,UAAU,EAAEF,UAAU,CAAC;YAC9BG,MAAMJ;YACNK,UAAUT;YACVU,MAAMN,OAAOO,UAAU;QACzB;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../../src/ai/core/media/image/handlers/multimodal.ts"],"sourcesContent":["import { generateText, type LanguageModel, ModelMessage } from 'ai'\n\nimport type { ImageGenerationArgs, MediaResult, MultimodalImageFile } from '../../types.js'\n\nimport { convertToBuffer, getExtensionFromMimeType } from '../../utils.js'\n\n/**\n * Handle multimodal text-to-image generation (e.g., Gemini Nano Banana)\n * Uses generateText with image response modalities\n */\nexport async function generateMultimodalImage(\n model: LanguageModel,\n args: ImageGenerationArgs,\n): Promise<MediaResult> {\n const { images = [], prompt, providerOptions = {} } = args\n\n // Build Google-specific options with required defaults\n const googleOptions = {\n imageConfig: {\n aspectRatio: args.aspectRatio || providerOptions?.aspectRatio || '16:9',\n ...(providerOptions?.personGeneration && { personGeneration: providerOptions.personGeneration }),\n ...(providerOptions?.addWatermark !== undefined && { addWatermark: providerOptions.addWatermark }),\n },\n responseModalities: ['IMAGE', 'TEXT'],\n }\n \n const result = await generateText({\n model,\n // onStepFinish: (step) => {\n // console.log('step finish: ', step.files)\n // console.log('step finish: ', step.response)\n // },\n prompt: [\n {\n content: [{ type: 'text', text: prompt }, ...images],\n role: 'user',\n },\n ],\n providerOptions: {\n google: googleOptions,\n },\n })\n\n // Extract images from result.files\n const resultImages = (result.files?.filter((f: MultimodalImageFile) =>\n f.mediaType?.startsWith('image/'),\n ) || []) as MultimodalImageFile[]\n\n if (resultImages.length === 0) {\n // Check if Google returned a specific error message\n const responseBody = result.response?.body as { candidates?: Array<{ finishMessage?: string; finishReason?: string }> } | undefined\n const candidate = responseBody?.candidates?.[0]\n \n if (candidate?.finishMessage) {\n throw new Error(`Image generation failed: ${candidate.finishMessage}`)\n }\n if (candidate?.finishReason && candidate.finishReason !== 'STOP') {\n throw new Error(`Image generation failed with reason: ${candidate.finishReason}`)\n }\n \n throw new Error('No images returned from the model. The model may have generated only text.')\n }\n\n const files = resultImages.map((image) => {\n const mimeType = image.mediaType || 'image/png'\n const imageData = image.base64Data || image.uint8Array\n\n if (!imageData) {\n throw new Error('Image data is missing from the response.')\n }\n\n const buffer = convertToBuffer(imageData)\n const extension = getExtensionFromMimeType(mimeType)\n\n return {\n name: `generated.${extension}`,\n data: buffer,\n mimetype: mimeType,\n size: buffer.byteLength,\n }\n })\n\n return {\n files,\n }\n}\n"],"names":["generateText","convertToBuffer","getExtensionFromMimeType","generateMultimodalImage","model","args","images","prompt","providerOptions","googleOptions","imageConfig","aspectRatio","personGeneration","addWatermark","undefined","responseModalities","result","content","type","text","role","google","resultImages","files","filter","f","mediaType","startsWith","length","responseBody","response","body","candidate","candidates","finishMessage","Error","finishReason","map","image","mimeType","imageData","base64Data","uint8Array","buffer","extension","name","data","mimetype","size","byteLength"],"mappings":"AAAA,SAASA,YAAY,QAA0C,KAAI;AAInE,SAASC,eAAe,EAAEC,wBAAwB,QAAQ,iBAAgB;AAE1E;;;CAGC,GACD,OAAO,eAAeC,wBACpBC,KAAoB,EACpBC,IAAyB;IAEzB,MAAM,EAAEC,SAAS,EAAE,EAAEC,MAAM,EAAEC,kBAAkB,CAAC,CAAC,EAAE,GAAGH;IAEtD,uDAAuD;IACvD,MAAMI,gBAAgB;QACpBC,aAAa;YACXC,aAAaN,KAAKM,WAAW,IAAIH,iBAAiBG,eAAe;YACjE,GAAIH,iBAAiBI,oBAAoB;gBAAEA,kBAAkBJ,gBAAgBI,gBAAgB;YAAC,CAAC;YAC/F,GAAIJ,iBAAiBK,iBAAiBC,aAAa;gBAAED,cAAcL,gBAAgBK,YAAY;YAAC,CAAC;QACnG;QACAE,oBAAoB;YAAC;YAAS;SAAO;IACvC;IAEA,MAAMC,SAAS,MAAMhB,aAAa;QAChCI;QACA,4BAA4B;QAC5B,6CAA6C;QAC7C,gDAAgD;QAChD,KAAK;QACLG,QAAQ;YACN;gBACEU,SAAS;oBAAC;wBAAEC,MAAM;wBAAQC,MAAMZ;oBAAO;uBAAMD;iBAAO;gBACpDc,MAAM;YACR;SACD;QACDZ,iBAAiB;YACfa,QAAQZ;QACV;IACF;IAEA,mCAAmC;IACnC,MAAMa,eAAgBN,OAAOO,KAAK,EAAEC,OAAO,CAACC,IAC1CA,EAAEC,SAAS,EAAEC,WAAW,cACrB,EAAE;IAEP,IAAIL,aAAaM,MAAM,KAAK,GAAG;QAC7B,oDAAoD;QACpD,MAAMC,eAAeb,OAAOc,QAAQ,EAAEC;QACtC,MAAMC,YAAYH,cAAcI,YAAY,CAAC,EAAE;QAE/C,IAAID,WAAWE,eAAe;YAC5B,MAAM,IAAIC,MAAM,CAAC,yBAAyB,EAAEH,UAAUE,aAAa,CAAC,CAAC;QACvE;QACA,IAAIF,WAAWI,gBAAgBJ,UAAUI,YAAY,KAAK,QAAQ;YAChE,MAAM,IAAID,MAAM,CAAC,qCAAqC,EAAEH,UAAUI,YAAY,CAAC,CAAC;QAClF;QAEA,MAAM,IAAID,MAAM;IAClB;IAEA,MAAMZ,QAAQD,aAAae,GAAG,CAAC,CAACC;QAC9B,MAAMC,WAAWD,MAAMZ,SAAS,IAAI;QACpC,MAAMc,YAAYF,MAAMG,UAAU,IAAIH,MAAMI,UAAU;QAEtD,IAAI,CAACF,WAAW;YACd,MAAM,IAAIL,MAAM;QAClB;QAEA,MAAMQ,SAAS1C,gBAAgBuC;QAC/B,MAAMI,YAAY1C,yBAAyBqC;QAE3C,OAAO;YACLM,MAAM,CAAC,UAAU,EAAED,UAAU,CAAC;YAC9BE,MAAMH;YACNI,UAAUR;YACVS,MAAML,OAAOM,UAAU;QACzB;IACF;IAEA,OAAO;QACL1B;IACF;AACF"}
@@ -11,17 +11,20 @@ import { getExtensionFromMimeType } from '../../utils.js';
11
11
  prompt,
12
12
  providerOptions
13
13
  });
14
- const { image } = generateResult;
15
- const buffer = Buffer.from(image.base64, 'base64');
16
- const mimeType = image.mediaType || 'image/png';
17
- const extension = getExtensionFromMimeType(mimeType);
18
- return {
19
- file: {
14
+ const { images } = generateResult;
15
+ const files = images.map((image)=>{
16
+ const buffer = Buffer.from(image.base64, 'base64');
17
+ const mimeType = image.mediaType || 'image/png';
18
+ const extension = getExtensionFromMimeType(mimeType);
19
+ return {
20
20
  name: `generated.${extension}`,
21
21
  data: buffer,
22
22
  mimetype: mimeType,
23
23
  size: buffer.byteLength
24
- }
24
+ };
25
+ });
26
+ return {
27
+ files
25
28
  };
26
29
  }
27
30
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/ai/core/media/image/handlers/standard.ts"],"sourcesContent":["import { experimental_generateImage, type ImageModel } from 'ai'\n\nimport type { ImageGenerationArgs, MediaResult } from '../../types.js'\n\nimport { getExtensionFromMimeType } from '../../utils.js'\n\n/**\n * Handle standard image generation (DALL-E, Imagen, Flux, etc.)\n * Uses AI SDK's experimental_generateImage\n */\nexport async function generateStandardImage(\n model: ImageModel,\n args: ImageGenerationArgs,\n): Promise<MediaResult> {\n const { n = 1, prompt, providerOptions } = args\n\n const generateResult = await experimental_generateImage({\n model,\n n,\n prompt,\n providerOptions,\n })\n\n const { image } = generateResult\n\n const buffer = Buffer.from(image.base64, 'base64')\n const mimeType = image.mediaType || 'image/png'\n const extension = getExtensionFromMimeType(mimeType)\n\n return {\n file: {\n name: `generated.${extension}`,\n data: buffer,\n mimetype: mimeType,\n size: buffer.byteLength,\n },\n }\n}\n"],"names":["experimental_generateImage","getExtensionFromMimeType","generateStandardImage","model","args","n","prompt","providerOptions","generateResult","image","buffer","Buffer","from","base64","mimeType","mediaType","extension","file","name","data","mimetype","size","byteLength"],"mappings":"AAAA,SAASA,0BAA0B,QAAyB,KAAI;AAIhE,SAASC,wBAAwB,QAAQ,iBAAgB;AAEzD;;;CAGC,GACD,OAAO,eAAeC,sBACpBC,KAAiB,EACjBC,IAAyB;IAEzB,MAAM,EAAEC,IAAI,CAAC,EAAEC,MAAM,EAAEC,eAAe,EAAE,GAAGH;IAE3C,MAAMI,iBAAiB,MAAMR,2BAA2B;QACtDG;QACAE;QACAC;QACAC;IACF;IAEA,MAAM,EAAEE,KAAK,EAAE,GAAGD;IAElB,MAAME,SAASC,OAAOC,IAAI,CAACH,MAAMI,MAAM,EAAE;IACzC,MAAMC,WAAWL,MAAMM,SAAS,IAAI;IACpC,MAAMC,YAAYf,yBAAyBa;IAE3C,OAAO;QACLG,MAAM;YACJC,MAAM,CAAC,UAAU,EAAEF,UAAU,CAAC;YAC9BG,MAAMT;YACNU,UAAUN;YACVO,MAAMX,OAAOY,UAAU;QACzB;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../../src/ai/core/media/image/handlers/standard.ts"],"sourcesContent":["import { experimental_generateImage, type ImageModel } from 'ai'\n\nimport type { ImageGenerationArgs, MediaResult } from '../../types.js'\n\nimport { getExtensionFromMimeType } from '../../utils.js'\n\n/**\n * Handle standard image generation (DALL-E, Imagen, Flux, etc.)\n * Uses AI SDK's experimental_generateImage\n */\nexport async function generateStandardImage(\n model: ImageModel,\n args: ImageGenerationArgs,\n): Promise<MediaResult> {\n const { n = 1, prompt, providerOptions } = args\n\n const generateResult = await experimental_generateImage({\n model,\n n,\n prompt,\n providerOptions,\n })\n\n const { images } = generateResult\n\n const files = images.map((image) => {\n const buffer = Buffer.from(image.base64, 'base64')\n const mimeType = image.mediaType || 'image/png'\n const extension = getExtensionFromMimeType(mimeType)\n\n return {\n name: `generated.${extension}`,\n data: buffer,\n mimetype: mimeType,\n size: buffer.byteLength,\n }\n })\n\n return {\n files,\n }\n}\n"],"names":["experimental_generateImage","getExtensionFromMimeType","generateStandardImage","model","args","n","prompt","providerOptions","generateResult","images","files","map","image","buffer","Buffer","from","base64","mimeType","mediaType","extension","name","data","mimetype","size","byteLength"],"mappings":"AAAA,SAASA,0BAA0B,QAAyB,KAAI;AAIhE,SAASC,wBAAwB,QAAQ,iBAAgB;AAEzD;;;CAGC,GACD,OAAO,eAAeC,sBACpBC,KAAiB,EACjBC,IAAyB;IAEzB,MAAM,EAAEC,IAAI,CAAC,EAAEC,MAAM,EAAEC,eAAe,EAAE,GAAGH;IAE3C,MAAMI,iBAAiB,MAAMR,2BAA2B;QACtDG;QACAE;QACAC;QACAC;IACF;IAEA,MAAM,EAAEE,MAAM,EAAE,GAAGD;IAEnB,MAAME,QAAQD,OAAOE,GAAG,CAAC,CAACC;QACxB,MAAMC,SAASC,OAAOC,IAAI,CAACH,MAAMI,MAAM,EAAE;QACzC,MAAMC,WAAWL,MAAMM,SAAS,IAAI;QACpC,MAAMC,YAAYlB,yBAAyBgB;QAE3C,OAAO;YACLG,MAAM,CAAC,UAAU,EAAED,UAAU,CAAC;YAC9BE,MAAMR;YACNS,UAAUL;YACVM,MAAMV,OAAOW,UAAU;QACzB;IACF;IAEA,OAAO;QACLd;IACF;AACF"}
@@ -14,7 +14,6 @@ import { getExtensionFromMimeType } from '../utils.js';
14
14
  }
15
15
  // Get TTS model instance
16
16
  const model = await getTTSModel(payload, provider, modelId, args.providerOptions);
17
- console.log("model: ", model);
18
17
  // Dynamic import to support older SDK versions
19
18
  let generateSpeechFn;
20
19
  try {
@@ -34,7 +33,6 @@ import { getExtensionFromMimeType } from '../utils.js';
34
33
  text: prompt,
35
34
  voice
36
35
  });
37
- console.log("result", result);
38
36
  // Extract audio from result
39
37
  const { audio } = result;
40
38
  const mimeType = audio.mediaType || 'audio/mp3';
@@ -43,12 +41,14 @@ import { getExtensionFromMimeType } from '../utils.js';
43
41
  // Prefer uint8Array if available, else base64
44
42
  const dataBuffer = audio.uint8Array ? Buffer.from(audio.uint8Array) : Buffer.from(audio.base64, 'base64');
45
43
  return {
46
- file: {
47
- name: `speech.${extension}`,
48
- data: dataBuffer,
49
- mimetype: mimeType,
50
- size: dataBuffer.length
51
- }
44
+ files: [
45
+ {
46
+ name: `speech.${extension}`,
47
+ data: dataBuffer,
48
+ mimetype: mimeType,
49
+ size: dataBuffer.length
50
+ }
51
+ ]
52
52
  };
53
53
  }
54
54
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/ai/core/media/speech/generateSpeech.ts"],"sourcesContent":["import type { MediaResult, SpeechGenerationArgs } from '../types.js'\n\nimport { getGlobalDefaults, getTTSModel } from '../../../providers/registry.js'\nimport { getExtensionFromMimeType } from '../utils.js'\n\n/**\n * Generate speech from text using AI SDK's generateSpeech\n */\nexport async function generateSpeech(args: SpeechGenerationArgs): Promise<MediaResult> {\n const { model: modelId, payload, prompt, provider } = args\n let { voice } = args\n\n // Fallback to global default voice if not specified\n if (!voice) {\n const defaults = await getGlobalDefaults(payload)\n if (defaults?.tts?.voice) {\n voice = defaults.tts.voice\n }\n }\n\n // Get TTS model instance\n const model = await getTTSModel(payload, provider, modelId, args.providerOptions)\n console.log(\"model: \", model)\n\n // Dynamic import to support older SDK versions\n let generateSpeechFn\n try {\n const ai = await import('ai')\n generateSpeechFn = ai.experimental_generateSpeech\n } catch (_e) {\n throw new Error('generateSpeech not found in \"ai\" package. Please upgrade to the latest version.')\n }\n\n if (!generateSpeechFn) {\n throw new Error('generateSpeech not found in \"ai\" package. Please upgrade to the latest version.')\n }\n\n // TODO: fix with proper error handling\n const result = await generateSpeechFn({\n model,\n providerOptions: args.providerOptions,\n speed: args.speed,\n text: prompt,\n voice,\n })\n console.log(\"result\", result)\n // Extract audio from result\n const { audio } = result\n const mimeType = audio.mediaType || 'audio/mp3'\n \n // Try to get format from audio object, otherwise infer from mime type\n const extension = audio.format || getExtensionFromMimeType(mimeType)\n\n // Prefer uint8Array if available, else base64\n const dataBuffer = audio.uint8Array\n ? Buffer.from(audio.uint8Array)\n : Buffer.from(audio.base64, 'base64')\n\n return {\n file: {\n name: `speech.${extension}`,\n data: dataBuffer,\n mimetype: mimeType,\n size: dataBuffer.length,\n },\n }\n}\n"],"names":["getGlobalDefaults","getTTSModel","getExtensionFromMimeType","generateSpeech","args","model","modelId","payload","prompt","provider","voice","defaults","tts","providerOptions","console","log","generateSpeechFn","ai","experimental_generateSpeech","_e","Error","result","speed","text","audio","mimeType","mediaType","extension","format","dataBuffer","uint8Array","Buffer","from","base64","file","name","data","mimetype","size","length"],"mappings":"AAEA,SAASA,iBAAiB,EAAEC,WAAW,QAAQ,iCAAgC;AAC/E,SAASC,wBAAwB,QAAQ,cAAa;AAEtD;;CAEC,GACD,OAAO,eAAeC,eAAeC,IAA0B;IAC7D,MAAM,EAAEC,OAAOC,OAAO,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,EAAE,GAAGL;IACtD,IAAI,EAAEM,KAAK,EAAE,GAAGN;IAEhB,oDAAoD;IACpD,IAAI,CAACM,OAAO;QACV,MAAMC,WAAW,MAAMX,kBAAkBO;QACzC,IAAII,UAAUC,KAAKF,OAAO;YACxBA,QAAQC,SAASC,GAAG,CAACF,KAAK;QAC5B;IACF;IAEA,yBAAyB;IACzB,MAAML,QAAQ,MAAMJ,YAAYM,SAASE,UAAUH,SAASF,KAAKS,eAAe;IAChFC,QAAQC,GAAG,CAAC,aAAaV;IAEzB,+CAA+C;IAC/C,IAAIW;IACJ,IAAI;QACF,MAAMC,KAAK,MAAM,MAAM,CAAC;QACxBD,mBAAmBC,GAAGC,2BAA2B;IACnD,EAAE,OAAOC,IAAI;QACX,MAAM,IAAIC,MAAM;IAClB;IAEA,IAAI,CAACJ,kBAAkB;QACrB,MAAM,IAAII,MAAM;IAClB;IAEA,uCAAuC;IACvC,MAAMC,SAAS,MAAML,iBAAiB;QACpCX;QACAQ,iBAAiBT,KAAKS,eAAe;QACrCS,OAAOlB,KAAKkB,KAAK;QACjBC,MAAMf;QACNE;IACF;IACAI,QAAQC,GAAG,CAAC,UAAUM;IACvB,4BAA4B;IAC3B,MAAM,EAAEG,KAAK,EAAE,GAAGH;IAClB,MAAMI,WAAWD,MAAME,SAAS,IAAI;IAEpC,sEAAsE;IACtE,MAAMC,YAAYH,MAAMI,MAAM,IAAI1B,yBAAyBuB;IAE3D,8CAA8C;IAC9C,MAAMI,aAAaL,MAAMM,UAAU,GAC/BC,OAAOC,IAAI,CAACR,MAAMM,UAAU,IAC5BC,OAAOC,IAAI,CAACR,MAAMS,MAAM,EAAE;IAE9B,OAAO;QACLC,MAAM;YACJC,MAAM,CAAC,OAAO,EAAER,UAAU,CAAC;YAC3BS,MAAMP;YACNQ,UAAUZ;YACVa,MAAMT,WAAWU,MAAM;QACzB;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../src/ai/core/media/speech/generateSpeech.ts"],"sourcesContent":["import type { MediaResult, SpeechGenerationArgs } from '../types.js'\n\nimport { getGlobalDefaults, getTTSModel } from '../../../providers/registry.js'\nimport { getExtensionFromMimeType } from '../utils.js'\n\n/**\n * Generate speech from text using AI SDK's generateSpeech\n */\nexport async function generateSpeech(args: SpeechGenerationArgs): Promise<MediaResult> {\n const { model: modelId, payload, prompt, provider } = args\n let { voice } = args\n\n // Fallback to global default voice if not specified\n if (!voice) {\n const defaults = await getGlobalDefaults(payload)\n if (defaults?.tts?.voice) {\n voice = defaults.tts.voice\n }\n }\n\n // Get TTS model instance\n const model = await getTTSModel(payload, provider, modelId, args.providerOptions)\n\n // Dynamic import to support older SDK versions\n let generateSpeechFn\n try {\n const ai = await import('ai')\n generateSpeechFn = ai.experimental_generateSpeech\n } catch (_e) {\n throw new Error('generateSpeech not found in \"ai\" package. Please upgrade to the latest version.')\n }\n\n if (!generateSpeechFn) {\n throw new Error('generateSpeech not found in \"ai\" package. Please upgrade to the latest version.')\n }\n\n // TODO: fix with proper error handling\n const result = await generateSpeechFn({\n model,\n providerOptions: args.providerOptions,\n speed: args.speed,\n text: prompt,\n voice,\n })\n\n // Extract audio from result\n const { audio } = result\n const mimeType = audio.mediaType || 'audio/mp3'\n \n // Try to get format from audio object, otherwise infer from mime type\n const extension = audio.format || getExtensionFromMimeType(mimeType)\n\n // Prefer uint8Array if available, else base64\n const dataBuffer = audio.uint8Array\n ? Buffer.from(audio.uint8Array)\n : Buffer.from(audio.base64, 'base64')\n\n return {\n files: [\n {\n name: `speech.${extension}`,\n data: dataBuffer,\n mimetype: mimeType,\n size: dataBuffer.length,\n },\n ],\n }\n}\n"],"names":["getGlobalDefaults","getTTSModel","getExtensionFromMimeType","generateSpeech","args","model","modelId","payload","prompt","provider","voice","defaults","tts","providerOptions","generateSpeechFn","ai","experimental_generateSpeech","_e","Error","result","speed","text","audio","mimeType","mediaType","extension","format","dataBuffer","uint8Array","Buffer","from","base64","files","name","data","mimetype","size","length"],"mappings":"AAEA,SAASA,iBAAiB,EAAEC,WAAW,QAAQ,iCAAgC;AAC/E,SAASC,wBAAwB,QAAQ,cAAa;AAEtD;;CAEC,GACD,OAAO,eAAeC,eAAeC,IAA0B;IAC7D,MAAM,EAAEC,OAAOC,OAAO,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,EAAE,GAAGL;IACtD,IAAI,EAAEM,KAAK,EAAE,GAAGN;IAEhB,oDAAoD;IACpD,IAAI,CAACM,OAAO;QACV,MAAMC,WAAW,MAAMX,kBAAkBO;QACzC,IAAII,UAAUC,KAAKF,OAAO;YACxBA,QAAQC,SAASC,GAAG,CAACF,KAAK;QAC5B;IACF;IAEA,yBAAyB;IACzB,MAAML,QAAQ,MAAMJ,YAAYM,SAASE,UAAUH,SAASF,KAAKS,eAAe;IAEhF,+CAA+C;IAC/C,IAAIC;IACJ,IAAI;QACF,MAAMC,KAAK,MAAM,MAAM,CAAC;QACxBD,mBAAmBC,GAAGC,2BAA2B;IACnD,EAAE,OAAOC,IAAI;QACX,MAAM,IAAIC,MAAM;IAClB;IAEA,IAAI,CAACJ,kBAAkB;QACrB,MAAM,IAAII,MAAM;IAClB;IAEA,uCAAuC;IACvC,MAAMC,SAAS,MAAML,iBAAiB;QACpCT;QACAQ,iBAAiBT,KAAKS,eAAe;QACrCO,OAAOhB,KAAKgB,KAAK;QACjBC,MAAMb;QACNE;IACF;IAED,4BAA4B;IAC3B,MAAM,EAAEY,KAAK,EAAE,GAAGH;IAClB,MAAMI,WAAWD,MAAME,SAAS,IAAI;IAEpC,sEAAsE;IACtE,MAAMC,YAAYH,MAAMI,MAAM,IAAIxB,yBAAyBqB;IAE3D,8CAA8C;IAC9C,MAAMI,aAAaL,MAAMM,UAAU,GAC/BC,OAAOC,IAAI,CAACR,MAAMM,UAAU,IAC5BC,OAAOC,IAAI,CAACR,MAAMS,MAAM,EAAE;IAE9B,OAAO;QACLC,OAAO;YACL;gBACEC,MAAM,CAAC,OAAO,EAAER,UAAU,CAAC;gBAC3BS,MAAMP;gBACNQ,UAAUZ;gBACVa,MAAMT,WAAWU,MAAM;YACzB;SACD;IACH;AACF"}
@@ -57,7 +57,7 @@ export interface MediaFile {
57
57
  * Can be either an immediate file result or an async job
58
58
  */
59
59
  export interface MediaResult {
60
- file?: MediaFile;
60
+ files?: MediaFile[];
61
61
  jobId?: string;
62
62
  progress?: number;
63
63
  status?: 'completed' | 'failed' | 'queued' | 'running';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/ai/core/media/types.ts"],"sourcesContent":["import type { ImagePart } from 'ai'\nimport type { Payload } from 'payload'\n\nimport type { ProviderOptions } from '../types.js'\n\n/**\n * Base interface for all media generation arguments\n */\nexport interface MediaGenerationArgs {\n model?: string\n payload: Payload\n prompt: string\n provider?: string\n providerOptions?: ProviderOptions\n}\n\n/**\n * Arguments specific to image generation\n */\nexport interface ImageGenerationArgs extends MediaGenerationArgs {\n aspectRatio?: string\n images?: ImagePart[]\n n?: number\n seed?: number\n size?: { height: number; width: number }\n}\n\n/**\n * Arguments specific to video generation\n */\nexport interface VideoGenerationArgs extends MediaGenerationArgs {\n callbackUrl?: string\n duration?: number\n fps?: number\n images?: ImagePart[]\n instructionId?: number | string\n mode?: 'i2v' | 't2v'\n}\n\n/**\n * Arguments specific to speech generation\n */\nexport interface SpeechGenerationArgs extends MediaGenerationArgs {\n audioFormat?: string\n speed?: number\n voice?: string\n}\n\n/**\n * Generated media file\n */\nexport interface MediaFile {\n data: Buffer\n mimetype: string\n name: string\n size: number\n}\n\n/**\n * Result from media generation\n * Can be either an immediate file result or an async job\n */\nexport interface MediaResult {\n // Immediate result (image, speech)\n file?: MediaFile\n\n // Async job result (video)\n jobId?: string\n progress?: number\n status?: 'completed' | 'failed' | 'queued' | 'running'\n taskId?: string\n data?: any\n}\n\n/**\n * Internal type for multimodal image files from AI SDK\n */\nexport interface MultimodalImageFile {\n base64Data?: string\n mediaType?: string\n uint8Array?: Uint8Array\n}\n"],"names":[],"mappings":"AA0EA;;CAEC,GACD,WAIC"}
1
+ {"version":3,"sources":["../../../../src/ai/core/media/types.ts"],"sourcesContent":["import type { ImagePart } from 'ai'\nimport type { Payload } from 'payload'\n\nimport type { ProviderOptions } from '../types.js'\n\n/**\n * Base interface for all media generation arguments\n */\nexport interface MediaGenerationArgs {\n model?: string\n payload: Payload\n prompt: string\n provider?: string\n providerOptions?: ProviderOptions\n}\n\n/**\n * Arguments specific to image generation\n */\nexport interface ImageGenerationArgs extends MediaGenerationArgs {\n aspectRatio?: string\n images?: ImagePart[]\n n?: number\n seed?: number\n size?: { height: number; width: number }\n}\n\n/**\n * Arguments specific to video generation\n */\nexport interface VideoGenerationArgs extends MediaGenerationArgs {\n callbackUrl?: string\n duration?: number\n fps?: number\n images?: ImagePart[]\n instructionId?: number | string\n mode?: 'i2v' | 't2v'\n}\n\n/**\n * Arguments specific to speech generation\n */\nexport interface SpeechGenerationArgs extends MediaGenerationArgs {\n audioFormat?: string\n speed?: number\n voice?: string\n}\n\n/**\n * Generated media file\n */\nexport interface MediaFile {\n data: Buffer\n mimetype: string\n name: string\n size: number\n}\n\n/**\n * Result from media generation\n * Can be either an immediate file result or an async job\n */\nexport interface MediaResult {\n // Immediate result (image, speech)\n files?: MediaFile[]\n\n // Async job result (video)\n jobId?: string\n progress?: number\n status?: 'completed' | 'failed' | 'queued' | 'running'\n taskId?: string\n data?: any\n}\n\n/**\n * Internal type for multimodal image files from AI SDK\n */\nexport interface MultimodalImageFile {\n base64Data?: string\n mediaType?: string\n uint8Array?: Uint8Array\n}\n"],"names":[],"mappings":"AA0EA;;CAEC,GACD,WAIC"}
@@ -45,12 +45,12 @@ function isZodSchema(schema) {
45
45
  } else {
46
46
  options.prompt = prompt;
47
47
  }
48
- console.log("options.messages : ", options.messages);
49
- console.log('prompt : ', prompt);
50
- console.log('args.images : ', args.images);
51
48
  if (providerOptions) {
52
49
  options.providerOptions = providerOptions;
53
50
  }
51
+ if (rest.onFinish) {
52
+ options.onFinish = rest.onFinish;
53
+ }
54
54
  return sdkStreamObject(options);
55
55
  }
56
56
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ai/core/streamObject.ts"],"sourcesContent":["import { type ImagePart, jsonSchema, streamObject as sdkStreamObject, type TextPart } from 'ai'\n\nimport type { PayloadGenerateObjectArgs } from './types.js'\n\nimport { getLanguageModel } from '../providers/registry.js'\n\nfunction isZodSchema(schema: unknown): boolean {\n return typeof schema === 'object' && schema !== null && '_def' in schema\n}\n\n/**\n * Stream structured output using AI SDK's streamObject\n * This is a thin wrapper that resolves the model from the registry\n * and passes everything directly to the AI SDK for streaming\n */\nexport async function streamObject(args: PayloadGenerateObjectArgs) {\n const { \n maxTokens, \n mode,\n model: modelId,\n payload,\n prompt,\n provider,\n providerOptions,\n schema,\n system,\n temperature,\n ...rest\n } = args\n \n // Resolve model from registry\n const model = await getLanguageModel(payload, provider, modelId, providerOptions)\n \n // Return streaming result from AI SDK\n const options: Record<string, unknown> = {\n mode: mode || 'auto',\n model,\n schema: schema ? (isZodSchema(schema) ? schema : jsonSchema(schema as Record<string, unknown>)) : undefined,\n system,\n temperature: temperature ?? 0.7,\n ...(maxTokens ? { maxOutputTokens: maxTokens } : {}),\n }\n\n // Handle multimodal input\n if ((args.images && args.images.length > 0) || (args.messages && args.messages.length > 0)) {\n if (args.messages) {\n options.messages = args.messages\n } else {\n // Construct multimodal message from prompt and images\n const content: Array<ImagePart | TextPart> = [\n { type: 'text', text: prompt },\n ...(args.images || []),\n ]\n\n options.messages = [\n { content, role: 'user' as const },\n ]\n }\n } else {\n options.prompt = prompt\n }\n\n console.log(\"options.messages : \",options.messages)\n console.log('prompt : ', prompt)\n console.log('args.images : ', args.images)\n\n if (providerOptions) {\n options.providerOptions = providerOptions\n }\n\n return sdkStreamObject(options as Parameters<typeof sdkStreamObject>[0])\n}\n"],"names":["jsonSchema","streamObject","sdkStreamObject","getLanguageModel","isZodSchema","schema","args","maxTokens","mode","model","modelId","payload","prompt","provider","providerOptions","system","temperature","rest","options","undefined","maxOutputTokens","images","length","messages","content","type","text","role","console","log"],"mappings":"AAAA,SAAyBA,UAAU,EAAEC,gBAAgBC,eAAe,QAAuB,KAAI;AAI/F,SAASC,gBAAgB,QAAQ,2BAA0B;AAE3D,SAASC,YAAYC,MAAe;IAClC,OAAO,OAAOA,WAAW,YAAYA,WAAW,QAAQ,UAAUA;AACpE;AAEA;;;;CAIC,GACD,OAAO,eAAeJ,aAAaK,IAA+B;IAChE,MAAM,EACJC,SAAS,EACTC,IAAI,EACJC,OAAOC,OAAO,EACdC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,eAAe,EACfT,MAAM,EACNU,MAAM,EACNC,WAAW,EACX,GAAGC,MACJ,GAAGX;IAEJ,8BAA8B;IAC9B,MAAMG,QAAQ,MAAMN,iBAAiBQ,SAASE,UAAUH,SAASI;IAEjE,sCAAsC;IACtC,MAAMI,UAAmC;QACvCV,MAAMA,QAAQ;QACdC;QACAJ,QAAQA,SAAUD,YAAYC,UAAUA,SAASL,WAAWK,UAAsCc;QAClGJ;QACAC,aAAaA,eAAe;QAC5B,GAAIT,YAAY;YAAEa,iBAAiBb;QAAU,IAAI,CAAC,CAAC;IACrD;IAEA,0BAA0B;IAC1B,IAAI,AAACD,KAAKe,MAAM,IAAIf,KAAKe,MAAM,CAACC,MAAM,GAAG,KAAOhB,KAAKiB,QAAQ,IAAIjB,KAAKiB,QAAQ,CAACD,MAAM,GAAG,GAAI;QAC1F,IAAIhB,KAAKiB,QAAQ,EAAE;YACjBL,QAAQK,QAAQ,GAAGjB,KAAKiB,QAAQ;QAClC,OAAO;YACL,sDAAsD;YACtD,MAAMC,UAAuC;gBAC3C;oBAAEC,MAAM;oBAAQC,MAAMd;gBAAO;mBACzBN,KAAKe,MAAM,IAAI,EAAE;aACtB;YAEDH,QAAQK,QAAQ,GAAG;gBACjB;oBAAEC;oBAASG,MAAM;gBAAgB;aAClC;QACH;IACF,OAAO;QACLT,QAAQN,MAAM,GAAGA;IACnB;IAEAgB,QAAQC,GAAG,CAAC,wBAAuBX,QAAQK,QAAQ;IACnDK,QAAQC,GAAG,CAAC,cAAcjB;IAC1BgB,QAAQC,GAAG,CAAC,oBAAoBvB,KAAKe,MAAM;IAE3C,IAAIP,iBAAiB;QACnBI,QAAQJ,eAAe,GAAGA;IAC5B;IAEA,OAAOZ,gBAAgBgB;AACzB"}
1
+ {"version":3,"sources":["../../../src/ai/core/streamObject.ts"],"sourcesContent":["import { type ImagePart, jsonSchema, streamObject as sdkStreamObject, type TextPart } from 'ai'\n\nimport type { PayloadGenerateObjectArgs } from './types.js'\n\nimport { getLanguageModel } from '../providers/registry.js'\n\nfunction isZodSchema(schema: unknown): boolean {\n return typeof schema === 'object' && schema !== null && '_def' in schema\n}\n\n/**\n * Stream structured output using AI SDK's streamObject\n * This is a thin wrapper that resolves the model from the registry\n * and passes everything directly to the AI SDK for streaming\n */\nexport async function streamObject(args: PayloadGenerateObjectArgs) {\n const { \n maxTokens, \n mode,\n model: modelId,\n payload,\n prompt,\n provider,\n providerOptions,\n schema,\n system,\n temperature,\n ...rest\n } = args\n \n // Resolve model from registry\n const model = await getLanguageModel(payload, provider, modelId, providerOptions)\n \n // Return streaming result from AI SDK\n const options: Record<string, unknown> = {\n mode: mode || 'auto',\n model,\n schema: schema ? (isZodSchema(schema) ? schema : jsonSchema(schema as Record<string, unknown>)) : undefined,\n system,\n temperature: temperature ?? 0.7,\n ...(maxTokens ? { maxOutputTokens: maxTokens } : {}),\n }\n\n // Handle multimodal input\n if ((args.images && args.images.length > 0) || (args.messages && args.messages.length > 0)) {\n if (args.messages) {\n options.messages = args.messages\n } else {\n // Construct multimodal message from prompt and images\n const content: Array<ImagePart | TextPart> = [\n { type: 'text', text: prompt },\n ...(args.images || []),\n ]\n\n options.messages = [\n { content, role: 'user' as const },\n ]\n }\n } else {\n options.prompt = prompt\n }\n\n\n if (providerOptions) {\n options.providerOptions = providerOptions\n }\n\n if (rest.onFinish) {\n options.onFinish = rest.onFinish\n }\n\n return sdkStreamObject(options as Parameters<typeof sdkStreamObject>[0])\n}\n"],"names":["jsonSchema","streamObject","sdkStreamObject","getLanguageModel","isZodSchema","schema","args","maxTokens","mode","model","modelId","payload","prompt","provider","providerOptions","system","temperature","rest","options","undefined","maxOutputTokens","images","length","messages","content","type","text","role","onFinish"],"mappings":"AAAA,SAAyBA,UAAU,EAAEC,gBAAgBC,eAAe,QAAuB,KAAI;AAI/F,SAASC,gBAAgB,QAAQ,2BAA0B;AAE3D,SAASC,YAAYC,MAAe;IAClC,OAAO,OAAOA,WAAW,YAAYA,WAAW,QAAQ,UAAUA;AACpE;AAEA;;;;CAIC,GACD,OAAO,eAAeJ,aAAaK,IAA+B;IAChE,MAAM,EACJC,SAAS,EACTC,IAAI,EACJC,OAAOC,OAAO,EACdC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,eAAe,EACfT,MAAM,EACNU,MAAM,EACNC,WAAW,EACX,GAAGC,MACJ,GAAGX;IAEJ,8BAA8B;IAC9B,MAAMG,QAAQ,MAAMN,iBAAiBQ,SAASE,UAAUH,SAASI;IAEjE,sCAAsC;IACtC,MAAMI,UAAmC;QACvCV,MAAMA,QAAQ;QACdC;QACAJ,QAAQA,SAAUD,YAAYC,UAAUA,SAASL,WAAWK,UAAsCc;QAClGJ;QACAC,aAAaA,eAAe;QAC5B,GAAIT,YAAY;YAAEa,iBAAiBb;QAAU,IAAI,CAAC,CAAC;IACrD;IAEA,0BAA0B;IAC1B,IAAI,AAACD,KAAKe,MAAM,IAAIf,KAAKe,MAAM,CAACC,MAAM,GAAG,KAAOhB,KAAKiB,QAAQ,IAAIjB,KAAKiB,QAAQ,CAACD,MAAM,GAAG,GAAI;QAC1F,IAAIhB,KAAKiB,QAAQ,EAAE;YACjBL,QAAQK,QAAQ,GAAGjB,KAAKiB,QAAQ;QAClC,OAAO;YACL,sDAAsD;YACtD,MAAMC,UAAuC;gBAC3C;oBAAEC,MAAM;oBAAQC,MAAMd;gBAAO;mBACzBN,KAAKe,MAAM,IAAI,EAAE;aACtB;YAEDH,QAAQK,QAAQ,GAAG;gBACjB;oBAAEC;oBAASG,MAAM;gBAAgB;aAClC;QACH;IACF,OAAO;QACLT,QAAQN,MAAM,GAAGA;IACnB;IAGA,IAAIE,iBAAiB;QACnBI,QAAQJ,eAAe,GAAGA;IAC5B;IAEA,IAAIG,KAAKW,QAAQ,EAAE;QACjBV,QAAQU,QAAQ,GAAGX,KAAKW,QAAQ;IAClC;IAEA,OAAO1B,gBAAgBgB;AACzB"}
@@ -27,6 +27,9 @@ export interface PayloadGenerationBaseArgs {
27
27
  export interface PayloadGenerateObjectArgs extends PayloadGenerationBaseArgs {
28
28
  images?: ImagePart[];
29
29
  mode?: 'auto' | 'json' | 'tool';
30
+ onFinish?: (event: {
31
+ object?: any;
32
+ }) => Promise<void> | void;
30
33
  schema?: Record<string, unknown> | z.ZodTypeAny;
31
34
  }
32
35
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ai/core/types.ts"],"sourcesContent":["import type { ImagePart, JSONValue, ModelMessage } from 'ai'\nimport type { Payload } from 'payload'\nimport type { z } from 'zod'\n\n/**\n * Provider options compatible with AI SDK's SharedV2ProviderOptions\n * SharedV2ProviderOptions = Record<string, Record<string, JSONValue>>\n */\nexport type ProviderOptions = Record<string, Record<string, JSONValue>>\n\n/**\n * Base arguments for all generation methods\n */\nexport interface PayloadGenerationBaseArgs {\n extractAttachments?: boolean\n maxTokens?: number\n messages?: ModelMessage[]\n model?: string\n payload: Payload\n prompt: string\n provider?: string\n providerOptions?: ProviderOptions\n system?: string\n temperature?: number\n}\n\n/**\n * Arguments for generateObject - structured output generation\n */\nexport interface PayloadGenerateObjectArgs extends PayloadGenerationBaseArgs {\n images?: ImagePart[]\n mode?: 'auto' | 'json' | 'tool'\n schema?: Record<string, unknown> | z.ZodTypeAny\n}\n\n/**\n * Arguments for generateText - simple text generation\n */\nexport interface PayloadGenerateTextArgs extends PayloadGenerationBaseArgs {\n // No additional fields needed for basic text generation\n}\n\n/**\n * Arguments for generateMedia - image/video generation\n */\nexport interface PayloadGenerateMediaArgs {\n aspectRatio?: string\n audioFormat?: string\n callbackUrl?: string\n duration?: number\n fps?: number\n images?: ImagePart[]\n instructionId?: number | string\n mode?: 'i2v' | 't2v'\n model?: string\n n?: number\n payload: Payload\n prompt: string\n provider?: string\n providerOptions?: ProviderOptions\n seed?: number\n size?: { height: number; width: number }\n speed?: number\n voice?: string\n}\n\n/**\n * Result from generateMedia - can be immediate file or async job\n */\nexport interface MediaResult {\n // Immediate result (image generation)\n file?: {\n data: Buffer\n mimetype: string\n name: string\n size: number\n }\n \n // Async job result (video generation)\n jobId?: string\n progress?: number\n status?: 'completed' | 'failed' | 'queued' | 'running'\n taskId?: string\n}\n\n/**\n * Internal type for multimodal image files\n */\nexport interface MultimodalImageFile {\n base64Data?: string\n mediaType?: string\n uint8Array?: Uint8Array\n}\n"],"names":[],"mappings":"AAqFA;;CAEC,GACD,WAIC"}
1
+ {"version":3,"sources":["../../../src/ai/core/types.ts"],"sourcesContent":["import type { ImagePart, JSONValue, ModelMessage } from 'ai'\nimport type { Payload } from 'payload'\nimport type { z } from 'zod'\n\n/**\n * Provider options compatible with AI SDK's SharedV2ProviderOptions\n * SharedV2ProviderOptions = Record<string, Record<string, JSONValue>>\n */\nexport type ProviderOptions = Record<string, Record<string, JSONValue>>\n\n/**\n * Base arguments for all generation methods\n */\nexport interface PayloadGenerationBaseArgs {\n extractAttachments?: boolean\n maxTokens?: number\n messages?: ModelMessage[]\n model?: string\n payload: Payload\n prompt: string\n provider?: string\n providerOptions?: ProviderOptions\n system?: string\n temperature?: number\n}\n\n/**\n * Arguments for generateObject - structured output generation\n */\nexport interface PayloadGenerateObjectArgs extends PayloadGenerationBaseArgs {\n images?: ImagePart[]\n mode?: 'auto' | 'json' | 'tool'\n onFinish?: (event: { object?: any }) => Promise<void> | void\n schema?: Record<string, unknown> | z.ZodTypeAny\n}\n\n/**\n * Arguments for generateText - simple text generation\n */\nexport interface PayloadGenerateTextArgs extends PayloadGenerationBaseArgs {\n // No additional fields needed for basic text generation\n}\n\n/**\n * Arguments for generateMedia - image/video generation\n */\nexport interface PayloadGenerateMediaArgs {\n aspectRatio?: string\n audioFormat?: string\n callbackUrl?: string\n duration?: number\n fps?: number\n images?: ImagePart[]\n instructionId?: number | string\n mode?: 'i2v' | 't2v'\n model?: string\n n?: number\n payload: Payload\n prompt: string\n provider?: string\n providerOptions?: ProviderOptions\n seed?: number\n size?: { height: number; width: number }\n speed?: number\n voice?: string\n}\n\n/**\n * Result from generateMedia - can be immediate file or async job\n */\nexport interface MediaResult {\n // Immediate result (image generation)\n file?: {\n data: Buffer\n mimetype: string\n name: string\n size: number\n }\n \n // Async job result (video generation)\n jobId?: string\n progress?: number\n status?: 'completed' | 'failed' | 'queued' | 'running'\n taskId?: string\n}\n\n/**\n * Internal type for multimodal image files\n */\nexport interface MultimodalImageFile {\n base64Data?: string\n mediaType?: string\n uint8Array?: Uint8Array\n}\n"],"names":[],"mappings":"AAsFA;;CAEC,GACD,WAIC"}
@@ -1,4 +1,3 @@
1
- import type { ActionPrompt, SeedPromptFunction } from '../types.js';
1
+ import type { ActionPrompt } from '../types.js';
2
2
  export declare 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:";
3
3
  export declare const defaultPrompts: ActionPrompt[];
4
- export declare const defaultSeedPrompts: SeedPromptFunction;
@@ -100,115 +100,5 @@ INSTRUCTIONS:
100
100
  -------------`
101
101
  }
102
102
  ];
103
- export const defaultSeedPrompts = ({ fieldLabel, fieldSchemaPaths, fieldType, path })=>{
104
- return {
105
- prompt: `field-type: ${fieldType}
106
- field-name: ${fieldLabel}
107
- schema-path: ${path}
108
-
109
- Give me a prompt that relate to the given field type and schema path.
110
-
111
- Generated prompt:
112
- `,
113
- system: `# AI Assistant for CMS Prompt Generation
114
-
115
- Your role: Generate prompts for Content Management System (CMS) fields based on field-type and schema-path.
116
-
117
- ## Key Guidelines:
118
- - Tailor prompts to specific field-type and purpose
119
- - Use schema-path for context
120
- - Include " {{ title }} " in every prompt
121
- - Be clear, concise, and instructive
122
- - Focus on content generation, not user perspective
123
- - For Image, Voice, or Banner fields, use provided example prompts verbatim
124
- - Image, Banner prompt MUST NOT CONTAIN ANY TYPOGRAPHY/TEXT DETAILS
125
-
126
- ## Field Types and Prompts:
127
-
128
- 1. richText:
129
- - Craft detailed, structured content
130
- - Include intro, sections, body, formatting, and conclusion
131
- - Aim for engaging, informative, and valuable content
132
-
133
- 2. text:
134
- - For titles: Generate concise, engaging titles
135
- - For keywords: List relevant SEO terms
136
-
137
- 3. textarea:
138
- - Provide comprehensive details (e.g., event information)
139
-
140
- 4. upload:
141
- - Describe high-quality images or media
142
-
143
- ## Schema-path Examples:
144
- - posts.title: Blog/article title
145
- - products.name: Product name
146
-
147
- ## Must Follow:
148
- - Adapt prompts to schema-path context
149
- - Generate content directly, avoid personal pronouns
150
- - Use provided examples as guidelines
151
-
152
- ### Examples for each field type along with generated prompt:
153
-
154
- For richText:
155
- field-type: richText
156
- field-name: Content
157
- schema-path: posts.content
158
- 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:
159
-
160
- - Engaging introduction that hooks the reader
161
- - Clearly defined sections with relevant subheadings
162
- - Well-researched and informative body paragraphs
163
- - Creative use of formatting to enhance readability (e.g., bullet points, blockquotes, italics, headings, bolds, other text formats)
164
- - Compelling conclusion that reinforces the main theme
165
- - Make the format easily digestible and clear for enhanced readability and improved CTR.
166
- - The user should be engaged, consistently interested, and feel that they’ve gained the knowledge they were seeking.
167
-
168
- Infuse 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.
169
- Feel 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.
170
-
171
- For text:
172
- field-type: text
173
- field-name: title
174
- schema-path: posts.title
175
- 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.
176
-
177
- For text:
178
- field-type: text
179
- field-name: keywords
180
- schema-path: posts.keywords
181
- 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.
182
- keywords will with comma separated.
183
-
184
-
185
- For textarea:
186
- field-type: textarea:
187
- field-name: details
188
- schema-path: posts.details
189
- Generated prompt: Provide comprehensive details for the event " {{ title }} ". Include essential information such as date, time, location, and any specific instructions or requirements.
190
-
191
- For upload:
192
- field-type: upload
193
- field-name: Featured Image
194
- schema-path: posts.image
195
- Generated prompt: Imagine {{ title }}
196
-
197
- For upload:
198
- field-type: upload
199
- field-name: Voice
200
- schema-path: posts.upload
201
- Generated prompt: {{ title }} {{ toHTML [provide schema-path here...] }}
202
-
203
-
204
- Remember 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.
205
-
206
- Schema Map Context:
207
- ${JSON.stringify(fieldSchemaPaths)}
208
-
209
- ${defaultSystemPrompt}
210
- `
211
- };
212
- };
213
103
 
214
104
  //# sourceMappingURL=prompts.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ai/prompts.ts"],"sourcesContent":["import type { ActionPrompt, SeedPromptFunction } from '../types.js'\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 defaultSeedPrompts: SeedPromptFunction = ({\n fieldLabel,\n fieldSchemaPaths,\n fieldType,\n path,\n}: {\n fieldLabel: string\n fieldSchemaPaths: any\n fieldType: string\n path: string\n}) => {\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 }} {{ toHTML [provide schema-path here...] }}\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","defaultSeedPrompts","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,kCAAkCA,eAAe,GAAG;mBACxD,CAAC;IAClB;IACA;QACEH,MAAM;QACNC,QACE,IAAM,CAAC;;;;;;;;;mBASM,CAAC;IAClB;IACA;QACED,MAAM;QACNC,QACE,IAAM,CAAC;;;;;;;;mBAQM,CAAC;IAClB;IACA;QACED,MAAM;QACNC,QAAQ,CAAC,EACPC,SAAS,EAAE,EACZ,GAAK,CAAC;;;;;;;;;MASL,EAAEA,SAAS,2BAA2BA,SAAS,GAAG;mBACrC,CAAC;IAClB;IACA;QACEF,MAAM;QACNI,QAAQ,IAAM,CAAC;;;IAGf,CAAC;QACDH,QAAQ,IACN,CAAC;;;;;;;;;AASP,CAAC;IACC;IACA;QACED,MAAM;QACNC,QAAQ,IACN,CAAC;;;;;;;mBAOY,CAAC;IAClB;IACA;QACED,MAAM;QACNC,QAAQ,CAAC,EAAEI,MAAM,EAAEH,SAAS,EAAE,EAAEC,eAAe,EAAE,EAAE,GACjD,CAAC,gEAAgE,EAAEE,OAAO;;;;yCAIvC,EAAEA,OAAO;;;IAG9C,EAAEH,SAAS,2BAA2BA,SAAS,GAAG;IAClD,EAAEC,eAAe,kCAAkCA,eAAe,GAAG;iBACxD,CAAC;IAChB;CACD,CAAA;AAED,OAAO,MAAMG,qBAAyC,CAAC,EACrDC,UAAU,EACVC,gBAAgB,EAChBC,SAAS,EACTC,IAAI,EAML;IACC,OAAO;QACLR,QAAQ,CAAC,YAAY,EAAEO,UAAU;YACzB,EAAEF,WAAW;aACZ,EAAEG,KAAK;;;;;AAKpB,CAAC;QACGT,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8Fb,EAAEU,KAAKC,SAAS,CAACJ,kBAAkB;;AAEnC,EAAEV,oBAAoB;AACtB,CAAC;IACC;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/ai/prompts.ts"],"sourcesContent":["import type { ActionPrompt } from '../types.js'\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"],"names":["defaultSystemPrompt","defaultPrompts","name","system","prompt","systemPrompt","layout","locale"],"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,kCAAkCA,eAAe,GAAG;mBACxD,CAAC;IAClB;IACA;QACEH,MAAM;QACNC,QACE,IAAM,CAAC;;;;;;;;;mBASM,CAAC;IAClB;IACA;QACED,MAAM;QACNC,QACE,IAAM,CAAC;;;;;;;;mBAQM,CAAC;IAClB;IACA;QACED,MAAM;QACNC,QAAQ,CAAC,EACPC,SAAS,EAAE,EACZ,GAAK,CAAC;;;;;;;;;MASL,EAAEA,SAAS,2BAA2BA,SAAS,GAAG;mBACrC,CAAC;IAClB;IACA;QACEF,MAAM;QACNI,QAAQ,IAAM,CAAC;;;IAGf,CAAC;QACDH,QAAQ,IACN,CAAC;;;;;;;;;AASP,CAAC;IACC;IACA;QACED,MAAM;QACNC,QAAQ,IACN,CAAC;;;;;;;mBAOY,CAAC;IAClB;IACA;QACED,MAAM;QACNC,QAAQ,CAAC,EAAEI,MAAM,EAAEH,SAAS,EAAE,EAAEC,eAAe,EAAE,EAAE,GACjD,CAAC,gEAAgE,EAAEE,OAAO;;;;yCAIvC,EAAEA,OAAO;;;IAG9C,EAAEH,SAAS,2BAA2BA,SAAS,GAAG;IAClD,EAAEC,eAAe,kCAAkCA,eAAe,GAAG;iBACxD,CAAC;IAChB;CACD,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { AnthropicIcon } from '../icons.js';
1
2
  export const anthropicBlock = {
2
3
  slug: 'anthropic',
3
4
  fields: [
@@ -212,7 +213,7 @@ export const anthropicBlock = {
212
213
  ]
213
214
  }
214
215
  ],
215
- imageURL: '/provider-icons/anthropic.webp',
216
+ imageURL: AnthropicIcon,
216
217
  labels: {
217
218
  plural: 'Anthropic Providers',
218
219
  singular: 'Anthropic'
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/ai/providers/blocks/anthropic.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nexport const anthropicBlock: Block = {\n slug: 'anthropic',\n fields: [\n {\n type: 'tabs',\n tabs: [\n // 1. Setup tab\n {\n fields: [\n {\n name: 'enabled',\n type: 'checkbox',\n defaultValue: true,\n label: 'Enabled',\n },\n {\n name: 'apiKey',\n type: 'text',\n admin: {\n components: {\n Field: '@ai-stack/payloadcms/client#EncryptedTextField',\n },\n description: 'Your Anthropic API key. Will be encrypted in the database.',\n },\n label: 'API Key',\n required: true,\n },\n ],\n label: 'Setup',\n },\n\n // 2. Provider Options tab\n {\n fields: [\n {\n name: 'textProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for text generation models.',\n },\n fields: [\n {\n name: 'temperature',\n type: 'number',\n defaultValue: 1.0,\n label: 'Default Temperature',\n max: 1.0,\n min: 0.0,\n },\n {\n name: 'max_tokens',\n type: 'number',\n defaultValue: 4096,\n label: 'Max Tokens',\n },\n {\n name: 'top_p',\n type: 'number',\n label: 'Top P',\n max: 1.0,\n min: 0.0,\n },\n {\n name: 'top_k',\n type: 'number',\n label: 'Top K',\n },\n ],\n label: 'Text Provider Options',\n },\n ],\n label: 'Provider Options',\n },\n\n // 3. Models tab\n {\n fields: [\n {\n name: 'models',\n type: 'array',\n admin: {\n components: {\n RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel',\n },\n initCollapsed: true,\n },\n defaultValue: [\n { id: 'claude-opus-4-1', name: 'Claude Opus 4.1', enabled: true, responseModalities: ['TEXT'], useCase: 'text' },\n { id: 'claude-opus-4-0', name: 'Claude Opus 4.0', enabled: true, responseModalities: ['TEXT'], useCase: 'text' },\n { id: 'claude-sonnet-4-0', name: 'Claude Sonnet 4.0', enabled: true, responseModalities: ['TEXT'], useCase: 'text' },\n {\n id: 'claude-3-5-sonnet-latest',\n name: 'Claude 3.5 Sonnet',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'claude-3-5-haiku-latest',\n name: 'Claude 3.5 Haiku',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n ],\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: { width: '33%' },\n label: 'Model ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: { width: '33%' },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'useCase',\n type: 'select',\n admin: { width: '33%' },\n dbName: 'anthropic-model-useCase',\n defaultValue: 'text',\n label: 'Use Case',\n options: [{ label: 'Text Generation', value: 'text' }],\n },\n ],\n },\n {\n name: 'responseModalities',\n type: 'select',\n admin: {\n description: 'Output capabilities of this model',\n width: '50%',\n },\n dbName: 'anthropic-model-modalities',\n hasMany: true,\n label: 'Response Modalities',\n options: [\n { label: 'Text', value: 'TEXT' },\n { label: 'Image', value: 'IMAGE' },\n { label: 'Audio', value: 'AUDIO' },\n ],\n },\n {\n name: 'enabled',\n type: 'checkbox',\n admin: {\n width: '50%',\n },\n defaultValue: true,\n label: 'Enabled',\n },\n ],\n label: 'Available Models',\n },\n ],\n label: 'Models',\n },\n ],\n },\n ],\n imageURL: '/provider-icons/anthropic.webp',\n labels: {\n plural: 'Anthropic Providers',\n singular: 'Anthropic',\n },\n}\n\n"],"names":["anthropicBlock","slug","fields","type","tabs","name","defaultValue","label","admin","components","Field","description","required","max","min","RowLabel","initCollapsed","id","enabled","responseModalities","useCase","width","dbName","options","value","hasMany","imageURL","labels","plural","singular"],"mappings":"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"}
1
+ {"version":3,"sources":["../../../../src/ai/providers/blocks/anthropic.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport { AnthropicIcon } from '../icons.js'\n\nexport const anthropicBlock: Block = {\n slug: 'anthropic',\n fields: [\n {\n type: 'tabs',\n tabs: [\n // 1. Setup tab\n {\n fields: [\n {\n name: 'enabled',\n type: 'checkbox',\n defaultValue: true,\n label: 'Enabled',\n },\n {\n name: 'apiKey',\n type: 'text',\n admin: {\n components: {\n Field: '@ai-stack/payloadcms/client#EncryptedTextField',\n },\n description: 'Your Anthropic API key. Will be encrypted in the database.',\n },\n label: 'API Key',\n required: true,\n },\n ],\n label: 'Setup',\n },\n\n // 2. Provider Options tab\n {\n fields: [\n {\n name: 'textProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for text generation models.',\n },\n fields: [\n {\n name: 'temperature',\n type: 'number',\n defaultValue: 1.0,\n label: 'Default Temperature',\n max: 1.0,\n min: 0.0,\n },\n {\n name: 'max_tokens',\n type: 'number',\n defaultValue: 4096,\n label: 'Max Tokens',\n },\n {\n name: 'top_p',\n type: 'number',\n label: 'Top P',\n max: 1.0,\n min: 0.0,\n },\n {\n name: 'top_k',\n type: 'number',\n label: 'Top K',\n },\n ],\n label: 'Text Provider Options',\n },\n ],\n label: 'Provider Options',\n },\n\n // 3. Models tab\n {\n fields: [\n {\n name: 'models',\n type: 'array',\n admin: {\n components: {\n RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel',\n },\n initCollapsed: true,\n },\n defaultValue: [\n { id: 'claude-opus-4-1', name: 'Claude Opus 4.1', enabled: true, responseModalities: ['TEXT'], useCase: 'text' },\n { id: 'claude-opus-4-0', name: 'Claude Opus 4.0', enabled: true, responseModalities: ['TEXT'], useCase: 'text' },\n { id: 'claude-sonnet-4-0', name: 'Claude Sonnet 4.0', enabled: true, responseModalities: ['TEXT'], useCase: 'text' },\n {\n id: 'claude-3-5-sonnet-latest',\n name: 'Claude 3.5 Sonnet',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'claude-3-5-haiku-latest',\n name: 'Claude 3.5 Haiku',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n ],\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: { width: '33%' },\n label: 'Model ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: { width: '33%' },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'useCase',\n type: 'select',\n admin: { width: '33%' },\n dbName: 'anthropic-model-useCase',\n defaultValue: 'text',\n label: 'Use Case',\n options: [{ label: 'Text Generation', value: 'text' }],\n },\n ],\n },\n {\n name: 'responseModalities',\n type: 'select',\n admin: {\n description: 'Output capabilities of this model',\n width: '50%',\n },\n dbName: 'anthropic-model-modalities',\n hasMany: true,\n label: 'Response Modalities',\n options: [\n { label: 'Text', value: 'TEXT' },\n { label: 'Image', value: 'IMAGE' },\n { label: 'Audio', value: 'AUDIO' },\n ],\n },\n {\n name: 'enabled',\n type: 'checkbox',\n admin: {\n width: '50%',\n },\n defaultValue: true,\n label: 'Enabled',\n },\n ],\n label: 'Available Models',\n },\n ],\n label: 'Models',\n },\n ],\n },\n ],\n imageURL: AnthropicIcon,\n labels: {\n plural: 'Anthropic Providers',\n singular: 'Anthropic',\n },\n}\n\n"],"names":["AnthropicIcon","anthropicBlock","slug","fields","type","tabs","name","defaultValue","label","admin","components","Field","description","required","max","min","RowLabel","initCollapsed","id","enabled","responseModalities","useCase","width","dbName","options","value","hasMany","imageURL","labels","plural","singular"],"mappings":"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"}
@@ -1,3 +1,4 @@
1
+ import { ElevenLabsIcon } from '../icons.js';
1
2
  export const elevenlabsBlock = {
2
3
  slug: 'elevenlabs',
3
4
  custom: {
@@ -308,7 +309,7 @@ export const elevenlabsBlock = {
308
309
  RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel'
309
310
  },
310
311
  description: 'Configure TTS models. Use the Voices and Provider Options tabs for detailed settings.',
311
- initCollapsed: false
312
+ initCollapsed: true
312
313
  },
313
314
  defaultValue: [
314
315
  {
@@ -438,7 +439,7 @@ export const elevenlabsBlock = {
438
439
  ]
439
440
  }
440
441
  ],
441
- imageURL: '/provider-icons/elevenlabs.webp',
442
+ imageURL: ElevenLabsIcon,
442
443
  labels: {
443
444
  plural: 'ElevenLabs Providers',
444
445
  singular: 'ElevenLabs'