@ai-stack/payloadcms 3.68.0-beta.2 → 3.68.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/core/media/image/generateImage.js +2 -6
- package/dist/ai/core/media/image/generateImage.js.map +1 -1
- package/dist/ai/providers/blocks/elevenlabs.js +1 -1
- package/dist/ai/providers/blocks/elevenlabs.js.map +1 -1
- package/dist/ai/providers/blocks/google.js +9 -5
- package/dist/ai/providers/blocks/google.js.map +1 -1
- package/dist/ai/providers/blocks/openai.js +1 -1
- package/dist/ai/providers/blocks/openai.js.map +1 -1
- package/dist/collections/AISettings.js +44 -17
- package/dist/collections/AISettings.js.map +1 -1
- package/dist/defaults.d.ts +1 -0
- package/dist/defaults.js +8 -0
- package/dist/defaults.js.map +1 -1
- package/dist/endpoints/fetchFields.js +10 -0
- package/dist/endpoints/fetchFields.js.map +1 -1
- package/dist/plugin.js +16 -32
- package/dist/plugin.js.map +1 -1
- package/dist/providers/InstructionsProvider/InstructionsProvider.js +44 -15
- package/dist/providers/InstructionsProvider/InstructionsProvider.js.map +1 -1
- package/dist/providers/InstructionsProvider/InstructionsProvider.jsx +36 -16
- package/dist/providers/InstructionsProvider/context.d.ts +3 -0
- package/dist/providers/InstructionsProvider/context.js +2 -0
- package/dist/providers/InstructionsProvider/context.js.map +1 -1
- package/dist/providers/InstructionsProvider/useInstructions.js +3 -1
- package/dist/providers/InstructionsProvider/useInstructions.js.map +1 -1
- package/dist/types.d.ts +0 -3
- package/dist/types.js.map +1 -1
- package/dist/ui/AIConfigDashboard/index.js +198 -22
- package/dist/ui/AIConfigDashboard/index.js.map +1 -1
- package/dist/ui/AIConfigDashboard/index.jsx +159 -13
- package/dist/ui/Compose/Compose.js +5 -3
- package/dist/ui/Compose/Compose.js.map +1 -1
- package/dist/ui/Compose/Compose.jsx +3 -3
- package/dist/ui/Compose/hooks/useGenerate.js +34 -131
- package/dist/ui/Compose/hooks/useGenerate.js.map +1 -1
- package/dist/ui/Compose/hooks/useGenerateUpload.d.ts +11 -0
- package/dist/ui/Compose/hooks/useGenerateUpload.js +123 -0
- package/dist/ui/Compose/hooks/useGenerateUpload.js.map +1 -0
- package/dist/ui/Compose/hooks/useStreamingUpdate.d.ts +8 -0
- package/dist/ui/Compose/hooks/useStreamingUpdate.js +48 -0
- package/dist/ui/Compose/hooks/useStreamingUpdate.js.map +1 -0
- package/dist/ui/EncryptedTextField/index.js +4 -4
- package/dist/ui/EncryptedTextField/index.js.map +1 -1
- package/dist/ui/EncryptedTextField/index.jsx +4 -4
- package/dist/utilities/seedProperties.d.ts +7 -0
- package/dist/utilities/seedProperties.js +117 -0
- package/dist/utilities/seedProperties.js.map +1 -0
- package/dist/utilities/setSafeLexicalState.js +80 -6
- package/dist/utilities/setSafeLexicalState.js.map +1 -1
- package/dist/utilities/updateFieldsConfig.d.ts +1 -1
- package/dist/utilities/updateFieldsConfig.js +1 -0
- package/dist/utilities/updateFieldsConfig.js.map +1 -1
- package/package.json +2 -1
- package/dist/init.d.ts +0 -7
- package/dist/init.js +0 -152
- package/dist/init.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
|
-
|
|
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
|
|
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"}
|
|
@@ -309,7 +309,7 @@ export const elevenlabsBlock = {
|
|
|
309
309
|
RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel'
|
|
310
310
|
},
|
|
311
311
|
description: 'Configure TTS models. Use the Voices and Provider Options tabs for detailed settings.',
|
|
312
|
-
initCollapsed:
|
|
312
|
+
initCollapsed: true
|
|
313
313
|
},
|
|
314
314
|
defaultValue: [
|
|
315
315
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/ai/providers/blocks/elevenlabs.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport { ElevenLabsIcon } from '../icons.js'\n\nexport const elevenlabsBlock: Block = {\n slug: 'elevenlabs',\n custom: {\n providerOptionsSchemas: {\n tts: {\n fields: [\n 'stability',\n 'similarity_boost',\n 'style',\n 'use_speaker_boost',\n 'seed',\n 'language_code',\n 'apply_text_normalization',\n 'apply_language_text_normalization',\n ],\n },\n },\n },\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:\n 'Your ElevenLabs API key. Will be encrypted in the database. Get yours at elevenlabs.io',\n },\n label: 'API Key',\n required: true,\n },\n ],\n label: 'Setup',\n },\n\n // 2. Connection tab\n {\n fields: [\n {\n type: 'collapsible',\n admin: {\n initCollapsed: false,\n },\n fields: [\n {\n name: 'baseURL',\n type: 'text',\n admin: {\n description:\n 'Optional. Override default API endpoint (defaults to https://api.elevenlabs.io/v1).',\n },\n defaultValue: 'https://api.elevenlabs.io/v1',\n label: 'Base URL',\n },\n {\n name: 'headers',\n type: 'array',\n admin: {\n description: 'Optional. Custom headers to send with every request.',\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'key',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Name',\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Value',\n required: true,\n },\n ],\n },\n ],\n label: 'Custom Headers',\n },\n ],\n label: 'API & Network Settings',\n },\n ],\n label: 'Connection',\n },\n\n // 3. Voices tab (Existing)\n {\n fields: [\n {\n name: 'voicesFetcherUI',\n type: 'ui',\n admin: {\n components: {\n Field: '@ai-stack/payloadcms/client#VoicesFetcher',\n },\n },\n },\n {\n name: 'voices',\n type: 'array',\n admin: {\n description:\n 'Use the \"Fetch Voices\" button above to populate this list from your ElevenLabs account.',\n initCollapsed: false,\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'Voice ID from ElevenLabs',\n width: '40%',\n },\n label: 'Voice ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '40%',\n },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'enabled',\n type: 'checkbox',\n admin: {\n width: '20%',\n },\n defaultValue: true,\n label: 'Enabled',\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'category',\n type: 'select',\n admin: {\n width: '50%',\n },\n dbName: 'eleven-voice-category',\n label: 'Category',\n options: [\n { label: 'Premade', value: 'premade' },\n { label: 'Cloned', value: 'cloned' },\n { label: 'Professional', value: 'professional' },\n { label: 'Generated', value: 'generated' },\n ],\n },\n {\n name: 'preview_url',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Preview URL',\n },\n ],\n },\n {\n name: 'labels',\n type: 'json',\n admin: {\n description:\n 'Voice attributes like gender, age, accent (JSON object). Example: {\"gender\": \"female\", \"age\": \"young\", \"accent\": \"american\"}',\n },\n label: 'Labels',\n },\n ],\n label: 'Available Voices',\n },\n ],\n label: 'Voices',\n },\n\n // 4. Provider Options (NEW)\n {\n fields: [\n {\n name: 'ttsProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for ElevenLabs TTS.',\n },\n fields: [\n {\n name: 'voice_settings',\n type: 'group',\n fields: [\n {\n name: 'stability',\n type: 'number',\n defaultValue: 0.5,\n label: 'Default Stability',\n max: 1,\n min: 0,\n },\n {\n name: 'similarity_boost',\n type: 'number',\n defaultValue: 0.75,\n label: 'Default Similarity Boost',\n max: 1,\n min: 0,\n },\n {\n name: 'style',\n type: 'number',\n defaultValue: 0,\n label: 'Default Style',\n max: 1,\n min: 0,\n },\n {\n name: 'use_speaker_boost',\n type: 'checkbox',\n defaultValue: false,\n label: 'Use Speaker Boost',\n },\n ],\n label: 'Voice Settings',\n },\n {\n name: 'seed',\n type: 'number',\n label: 'Default Seed',\n max: 4294967295,\n min: 0,\n },\n {\n name: 'apply_text_normalization',\n type: 'select',\n dbName: 'eleven-tts-normalization',\n defaultValue: 'auto',\n label: 'Text Normalization',\n options: [\n { label: 'Auto', value: 'auto' },\n { label: 'On', value: 'on' },\n { label: 'Off', value: 'off' },\n ],\n },\n {\n name: 'language_code',\n type: 'text',\n admin: {\n placeholder: 'en',\n },\n label: 'Language Code',\n },\n ],\n label: 'TTS Provider Options',\n },\n ],\n label: 'Provider Options',\n },\n\n // 5. Models (SIMPLIFIED - no per-model settings)\n {\n fields: [\n {\n name: 'models',\n type: 'array',\n admin: {\n components: {\n RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel',\n },\n description:\n 'Configure TTS models. Use the Voices and Provider Options tabs for detailed settings.',\n initCollapsed: false,\n },\n defaultValue: [\n {\n id: 'eleven_flash_v2_5',\n name: 'Flash V2.5 (Fastest)',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n {\n id: 'eleven_turbo_v2_5',\n name: 'Turbo V2.5 (Latest)',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n {\n id: 'eleven_multilingual_v2',\n name: 'Multilingual V2',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n {\n id: 'eleven_turbo_v2',\n name: 'Turbo V2',\n enabled: false,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n ],\n fields: [\n // Basic info\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'Model ID (e.g., eleven_flash_v2_5)',\n width: '50%',\n },\n label: 'Model ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Display Name',\n required: true,\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'useCase',\n type: 'select',\n admin: {\n width: '33%',\n },\n dbName: 'eleven-model-useCase',\n defaultValue: 'tts',\n label: 'Use Case',\n options: [{ label: 'Text-to-Speech', value: 'tts' }],\n },\n {\n name: 'responseModalities',\n type: 'select',\n admin: {\n description: 'Output capabilities of this model',\n width: '33%',\n },\n dbName: 'eleven-model-modalities',\n hasMany: true,\n label: 'Response Modalities',\n options: [\n { label: 'Text', value: 'TEXT' },\n { label: 'Audio', value: 'AUDIO' },\n ],\n },\n {\n name: 'enabled',\n type: 'checkbox',\n admin: {\n width: '33%',\n },\n defaultValue: true,\n label: 'Enabled',\n },\n ],\n },\n ],\n label: 'Available Models',\n labels: {\n plural: 'Models',\n singular: 'Model',\n },\n },\n ],\n label: 'Models',\n },\n ],\n },\n ],\n imageURL: ElevenLabsIcon,\n labels: {\n plural: 'ElevenLabs Providers',\n singular: 'ElevenLabs',\n },\n}\n"],"names":["ElevenLabsIcon","elevenlabsBlock","slug","custom","providerOptionsSchemas","tts","fields","type","tabs","name","defaultValue","label","admin","components","Field","description","required","initCollapsed","width","dbName","options","value","max","min","placeholder","RowLabel","id","enabled","responseModalities","useCase","hasMany","labels","plural","singular","imageURL"],"mappings":"AAEA,SAASA,cAAc,QAAQ,cAAa;AAE5C,OAAO,MAAMC,kBAAyB;IACpCC,MAAM;IACNC,QAAQ;QACNC,wBAAwB;YACtBC,KAAK;gBACHC,QAAQ;oBACN;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;iBACD;YACH;QACF;IACF;IACAA,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;gBACJ,eAAe;gBACf;oBACEF,QAAQ;wBACN;4BACEG,MAAM;4BACNF,MAAM;4BACNG,cAAc;4BACdC,OAAO;wBACT;wBACA;4BACEF,MAAM;4BACNF,MAAM;4BACNK,OAAO;gCACLC,YAAY;oCACVC,OAAO;gCACT;gCACAC,aACE;4BACJ;4BACAJ,OAAO;4BACPK,UAAU;wBACZ;qBACD;oBACDL,OAAO;gBACT;gBAEA,oBAAoB;gBACpB;oBACEL,QAAQ;wBACN;4BACEC,MAAM;4BACNK,OAAO;gCACLK,eAAe;4BACjB;4BACAX,QAAQ;gCACN;oCACEG,MAAM;oCACNF,MAAM;oCACNK,OAAO;wCACLG,aACE;oCACJ;oCACAL,cAAc;oCACdC,OAAO;gCACT;gCACA;oCACEF,MAAM;oCACNF,MAAM;oCACNK,OAAO;wCACLG,aAAa;oCACf;oCACAT,QAAQ;wCACN;4CACEC,MAAM;4CACND,QAAQ;gDACN;oDACEG,MAAM;oDACNF,MAAM;oDACNK,OAAO;wD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M,OAAO;4CACT;4CACAR,cAAc;4CACdC,OAAO;wCACT;qCACD;gCACH;6BACD;4BACDA,OAAO;4BACPoB,QAAQ;gCACNC,QAAQ;gCACRC,UAAU;4BACZ;wBACF;qBACD;oBACDtB,OAAO;gBACT;aACD;QACH;KACD;IACDuB,UAAUlC;IACV+B,QAAQ;QACNC,QAAQ;QACRC,UAAU;IACZ;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/ai/providers/blocks/elevenlabs.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport { ElevenLabsIcon } from '../icons.js'\n\nexport const elevenlabsBlock: Block = {\n slug: 'elevenlabs',\n custom: {\n providerOptionsSchemas: {\n tts: {\n fields: [\n 'stability',\n 'similarity_boost',\n 'style',\n 'use_speaker_boost',\n 'seed',\n 'language_code',\n 'apply_text_normalization',\n 'apply_language_text_normalization',\n ],\n },\n },\n },\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:\n 'Your ElevenLabs API key. Will be encrypted in the database. Get yours at elevenlabs.io',\n },\n label: 'API Key',\n required: true,\n },\n ],\n label: 'Setup',\n },\n\n // 2. Connection tab\n {\n fields: [\n {\n type: 'collapsible',\n admin: {\n initCollapsed: false,\n },\n fields: [\n {\n name: 'baseURL',\n type: 'text',\n admin: {\n description:\n 'Optional. Override default API endpoint (defaults to https://api.elevenlabs.io/v1).',\n },\n defaultValue: 'https://api.elevenlabs.io/v1',\n label: 'Base URL',\n },\n {\n name: 'headers',\n type: 'array',\n admin: {\n description: 'Optional. Custom headers to send with every request.',\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'key',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Name',\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Value',\n required: true,\n },\n ],\n },\n ],\n label: 'Custom Headers',\n },\n ],\n label: 'API & Network Settings',\n },\n ],\n label: 'Connection',\n },\n\n // 3. Voices tab (Existing)\n {\n fields: [\n {\n name: 'voicesFetcherUI',\n type: 'ui',\n admin: {\n components: {\n Field: '@ai-stack/payloadcms/client#VoicesFetcher',\n },\n },\n },\n {\n name: 'voices',\n type: 'array',\n admin: {\n description:\n 'Use the \"Fetch Voices\" button above to populate this list from your ElevenLabs account.',\n initCollapsed: false,\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'Voice ID from ElevenLabs',\n width: '40%',\n },\n label: 'Voice ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '40%',\n },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'enabled',\n type: 'checkbox',\n admin: {\n width: '20%',\n },\n defaultValue: true,\n label: 'Enabled',\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'category',\n type: 'select',\n admin: {\n width: '50%',\n },\n dbName: 'eleven-voice-category',\n label: 'Category',\n options: [\n { label: 'Premade', value: 'premade' },\n { label: 'Cloned', value: 'cloned' },\n { label: 'Professional', value: 'professional' },\n { label: 'Generated', value: 'generated' },\n ],\n },\n {\n name: 'preview_url',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Preview URL',\n },\n ],\n },\n {\n name: 'labels',\n type: 'json',\n admin: {\n description:\n 'Voice attributes like gender, age, accent (JSON object). Example: {\"gender\": \"female\", \"age\": \"young\", \"accent\": \"american\"}',\n },\n label: 'Labels',\n },\n ],\n label: 'Available Voices',\n },\n ],\n label: 'Voices',\n },\n\n // 4. Provider Options (NEW)\n {\n fields: [\n {\n name: 'ttsProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for ElevenLabs TTS.',\n },\n fields: [\n {\n name: 'voice_settings',\n type: 'group',\n fields: [\n {\n name: 'stability',\n type: 'number',\n defaultValue: 0.5,\n label: 'Default Stability',\n max: 1,\n min: 0,\n },\n {\n name: 'similarity_boost',\n type: 'number',\n defaultValue: 0.75,\n label: 'Default Similarity Boost',\n max: 1,\n min: 0,\n },\n {\n name: 'style',\n type: 'number',\n defaultValue: 0,\n label: 'Default Style',\n max: 1,\n min: 0,\n },\n {\n name: 'use_speaker_boost',\n type: 'checkbox',\n defaultValue: false,\n label: 'Use Speaker Boost',\n },\n ],\n label: 'Voice Settings',\n },\n {\n name: 'seed',\n type: 'number',\n label: 'Default Seed',\n max: 4294967295,\n min: 0,\n },\n {\n name: 'apply_text_normalization',\n type: 'select',\n dbName: 'eleven-tts-normalization',\n defaultValue: 'auto',\n label: 'Text Normalization',\n options: [\n { label: 'Auto', value: 'auto' },\n { label: 'On', value: 'on' },\n { label: 'Off', value: 'off' },\n ],\n },\n {\n name: 'language_code',\n type: 'text',\n admin: {\n placeholder: 'en',\n },\n label: 'Language Code',\n },\n ],\n label: 'TTS Provider Options',\n },\n ],\n label: 'Provider Options',\n },\n\n // 5. Models (SIMPLIFIED - no per-model settings)\n {\n fields: [\n {\n name: 'models',\n type: 'array',\n admin: {\n components: {\n RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel',\n },\n description:\n 'Configure TTS models. Use the Voices and Provider Options tabs for detailed settings.',\n initCollapsed: true,\n },\n defaultValue: [\n {\n id: 'eleven_flash_v2_5',\n name: 'Flash V2.5 (Fastest)',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n {\n id: 'eleven_turbo_v2_5',\n name: 'Turbo V2.5 (Latest)',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n {\n id: 'eleven_multilingual_v2',\n name: 'Multilingual V2',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n {\n id: 'eleven_turbo_v2',\n name: 'Turbo V2',\n enabled: false,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n ],\n fields: [\n // Basic info\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'Model ID (e.g., eleven_flash_v2_5)',\n width: '50%',\n },\n label: 'Model ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Display Name',\n required: true,\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'useCase',\n type: 'select',\n admin: {\n width: '33%',\n },\n dbName: 'eleven-model-useCase',\n defaultValue: 'tts',\n label: 'Use Case',\n options: [{ label: 'Text-to-Speech', value: 'tts' }],\n },\n {\n name: 'responseModalities',\n type: 'select',\n admin: {\n description: 'Output capabilities of this model',\n width: '33%',\n },\n dbName: 'eleven-model-modalities',\n hasMany: true,\n label: 'Response Modalities',\n options: [\n { label: 'Text', value: 'TEXT' },\n { label: 'Audio', value: 'AUDIO' },\n ],\n },\n {\n name: 'enabled',\n type: 'checkbox',\n admin: {\n width: '33%',\n },\n defaultValue: true,\n label: 'Enabled',\n },\n ],\n },\n ],\n label: 'Available Models',\n labels: {\n plural: 'Models',\n singular: 'Model',\n },\n },\n ],\n label: 'Models',\n },\n ],\n },\n ],\n imageURL: ElevenLabsIcon,\n labels: {\n plural: 'ElevenLabs Providers',\n singular: 'ElevenLabs',\n },\n}\n"],"names":["ElevenLabsIcon","elevenlabsBlock","slug","custom","providerOptionsSchemas","tts","fields","type","tabs","name","defaultValue","label","admin","components","Field","description","required","initCollapsed","width","dbName","options","value","max","min","placeholder","RowLabel","id","enabled","responseModalities","useCase","hasMany","labels","plural","singular","imageURL"],"mappings":"AAEA,SAASA,cAAc,QAAQ,cAAa;AAE5C,OAAO,MAAMC,kBAAyB;IACpCC,MAAM;IACNC,QAAQ;QACNC,wBAAwB;YACtBC,KAAK;gBACHC,QAAQ;oBACN;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;iBACD;YACH;QACF;IACF;IACAA,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;gBACJ,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wCACZ;wCACA;4CACEP,MAAM;4CACNF,MAAM;4CACNK,OAAO;gDACLM,OAAO;4CACT;4CACAP,OAAO;4CACPK,UAAU;wCACZ;qCACD;gCACH;gCACA;oCACET,MAAM;oCACND,QAAQ;wCACN;4CACEG,MAAM;4CACNF,MAAM;4CACNK,OAAO;gDACLM,OAAO;4CACT;4CACAC,QAAQ;4CACRT,cAAc;4CACdC,OAAO;4CACPS,SAAS;gDAAC;oDAAET,OAAO;oDAAkBU,OAAO;gDAAM;6CAAE;wCACtD;wCACA;4CACEZ,MAAM;4CACNF,MAAM;4CACNK,OAAO;gDACLG,aAAa;gDACbG,OAAO;4CACT;4CACAC,QAAQ;4CACRW,SAAS;4CACTnB,OAAO;4CACPS,SAAS;gDACP;oDAAET,OAAO;oDAAQU,OAAO;gDAAO;gDAC/B;oDAAEV,OAAO;oDAASU,OAAO;gDAAQ;6CAClC;wCACH;wCACA;4CACEZ,MAAM;4CACNF,MAAM;4CACNK,OAAO;gDACLM,OAAO;4CACT;4CACAR,cAAc;4CACdC,OAAO;wCACT;qCACD;gCACH;6BACD;4BACDA,OAAO;4BACPoB,QAAQ;gCACNC,QAAQ;gCACRC,UAAU;4BACZ;wBACF;qBACD;oBACDtB,OAAO;gBACT;aACD;QACH;KACD;IACDuB,UAAUlC;IACV+B,QAAQ;QACNC,QAAQ;QACRC,UAAU;IACZ;AACF,EAAC"}
|
|
@@ -418,7 +418,7 @@ export const googleBlock = {
|
|
|
418
418
|
RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel'
|
|
419
419
|
},
|
|
420
420
|
description: 'Keep this list short. Enable only the models you actually use.',
|
|
421
|
-
initCollapsed:
|
|
421
|
+
initCollapsed: true
|
|
422
422
|
},
|
|
423
423
|
defaultValue: [
|
|
424
424
|
// Text models
|
|
@@ -469,15 +469,19 @@ export const googleBlock = {
|
|
|
469
469
|
},
|
|
470
470
|
// Image models
|
|
471
471
|
{
|
|
472
|
-
id: '
|
|
473
|
-
name: '
|
|
472
|
+
id: 'gemini-2.5-flash-image',
|
|
473
|
+
name: 'Gemini 2.5 Flash Image',
|
|
474
474
|
enabled: true,
|
|
475
|
+
responseModalities: [
|
|
476
|
+
'IMAGE'
|
|
477
|
+
],
|
|
475
478
|
useCase: 'image'
|
|
476
479
|
},
|
|
477
480
|
{
|
|
478
|
-
id: '
|
|
479
|
-
name: '
|
|
481
|
+
id: 'imagen-4.0-generate-001',
|
|
482
|
+
name: 'Imagen 4',
|
|
480
483
|
enabled: true,
|
|
484
|
+
// TODO: fix this with proper definition for multimodel or image model only
|
|
481
485
|
responseModalities: [
|
|
482
486
|
'IMAGE'
|
|
483
487
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/ai/providers/blocks/google.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport { GoogleIcon } from '../icons.js'\n\nexport const googleBlock: Block = {\n slug: 'google',\n custom: {\n providerOptionsSchemas: {\n image: {\n fields: ['aspectRatio', 'personGeneration', 'seed', 'addWatermark'],\n },\n text: {\n fields: ['temperature', 'maxOutputTokens', 'topP', 'topK', 'safetySettings'],\n },\n tts: {\n fields: ['speed', 'volumeGainDb', 'speakingRate'],\n },\n },\n },\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:\n 'Optional. If empty, @ai-sdk/google will use the GOOGLE_GENERATIVE_AI_API_KEY environment variable.',\n },\n label: 'API Key',\n required: false,\n },\n ],\n label: 'Setup',\n },\n\n // 2. Connection tab\n {\n fields: [\n {\n type: 'collapsible',\n admin: {\n initCollapsed: false,\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'baseURL',\n type: 'text',\n admin: {\n description:\n 'Optional. Override default API endpoint (defaults to https://generativelanguage.googleapis.com/v1beta).',\n },\n label: 'Base URL',\n },\n ],\n },\n {\n name: 'headers',\n type: 'array',\n admin: {\n description:\n 'Optional. Extra headers to send with every request, for example routing through a proxy.',\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'key',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Name',\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Value',\n required: true,\n },\n ],\n },\n ],\n label: 'Custom Headers',\n },\n ],\n label: 'API & Network Settings',\n },\n ],\n label: 'Connection',\n },\n\n // 3. Voices tab (NEW)\n {\n fields: [\n {\n name: 'voices',\n type: 'array',\n admin: {\n description: 'Available voices for Gemini TTS models.',\n initCollapsed: false,\n },\n defaultValue: [\n { id: 'Puck', name: 'Puck (Upbeat)', enabled: true },\n { id: 'Charon', name: 'Charon (Informative)', enabled: true },\n { id: 'Kore', name: 'Kore (Firm)', enabled: true },\n { id: 'Fenrir', name: 'Fenrir (Excitable)', enabled: true },\n { id: 'Aoede', name: 'Aoede (Breezy)', enabled: true },\n { id: 'Zephyr', name: 'Zephyr (Bright)', enabled: true },\n ],\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'Voice ID used by Google API',\n width: '40%',\n },\n label: 'Voice ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '40%',\n },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'enabled',\n type: 'checkbox',\n admin: {\n width: '20%',\n },\n defaultValue: true,\n label: 'Enabled',\n },\n ],\n },\n ],\n label: 'Available Voices',\n },\n ],\n label: 'Voices',\n },\n\n // 4. Provider Options (NEW - One group per use case)\n {\n fields: [\n // TTS Settings\n {\n name: 'ttsProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for TTS models.',\n },\n fields: [\n {\n name: 'speed',\n type: 'number',\n defaultValue: 1.0,\n label: 'Speaking Rate',\n max: 4.0,\n min: 0.25,\n },\n {\n name: 'volumeGainDb',\n type: 'number',\n defaultValue: 0,\n label: 'Volume Gain (dB)',\n },\n ],\n label: 'TTS Provider Options',\n },\n\n // Image Settings\n {\n name: 'imageProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for image generation models.',\n },\n fields: [\n {\n name: 'aspectRatio',\n type: 'select',\n dbName: 'google-image-aspectRatio',\n defaultValue: '1:1',\n label: 'Default Aspect Ratio',\n options: [\n { label: '1:1 (Square)', value: '1:1' },\n { label: '16:9 (Landscape)', value: '16:9' },\n { label: '9:16 (Portrait)', value: '9:16' },\n { label: '4:3', value: '4:3' },\n { label: '3:4', value: '3:4' },\n ],\n },\n {\n name: 'personGeneration',\n type: 'select',\n dbName: 'google-image-personGeneration',\n defaultValue: 'allow_adult',\n label: 'Person Generation (Imagen)',\n options: [\n { label: 'Allow Adults Only', value: 'allow_adult' },\n { label: 'Allow All', value: 'allow_all' },\n { label: 'Do Not Allow', value: 'dont_allow' },\n ],\n },\n {\n name: 'addWatermark',\n type: 'checkbox',\n defaultValue: true,\n label: 'Add SynthID Watermark',\n },\n ],\n label: 'Image Provider Options',\n },\n\n // Text Settings\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: 2.0,\n min: 0.0,\n },\n {\n name: 'maxOutputTokens',\n type: 'number',\n label: 'Max Output Tokens',\n },\n {\n name: 'topP',\n type: 'number',\n defaultValue: 0.95,\n label: 'Top P',\n max: 1.0,\n min: 0.0,\n },\n {\n name: 'topK',\n type: 'number',\n defaultValue: 40,\n label: 'Top K',\n },\n {\n name: 'safetySettings',\n type: 'array',\n admin: {\n description: 'Safety filter settings',\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'category',\n type: 'select',\n admin: {\n width: '50%',\n },\n dbName: 'google-safety-category',\n label: 'Category',\n options: [\n { label: 'Harassment', value: 'HARM_CATEGORY_HARASSMENT' },\n { label: 'Hate Speech', value: 'HARM_CATEGORY_HATE_SPEECH' },\n { label: 'Sexually Explicit', value: 'HARM_CATEGORY_SEXUALLY_EXPLICIT' },\n { label: 'Dangerous Content', value: 'HARM_CATEGORY_DANGEROUS_CONTENT' },\n ],\n required: true,\n },\n {\n name: 'threshold',\n type: 'select',\n admin: {\n width: '50%',\n },\n dbName: 'google-safety-threshold',\n label: 'Threshold',\n options: [\n { label: 'Block None', value: 'BLOCK_NONE' },\n { label: 'Block Low+', value: 'BLOCK_LOW_AND_ABOVE' },\n { label: 'Block Medium+', value: 'BLOCK_MEDIUM_AND_ABOVE' },\n { label: 'Block High', value: 'BLOCK_ONLY_HIGH' },\n ],\n required: true,\n },\n ],\n },\n ],\n label: 'Default Safety Settings',\n },\n ],\n label: 'Text Provider Options',\n },\n ],\n label: 'Provider Options',\n },\n\n // 5. Models tab (Simplified)\n {\n fields: [\n {\n name: 'models',\n type: 'array',\n admin: {\n components: {\n RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel',\n },\n description: 'Keep this list short. Enable only the models you actually use.',\n initCollapsed: false,\n },\n defaultValue: [\n // Text models\n {\n id: 'gemini-3-pro-preview',\n name: 'Gemini 3.0 Pro (Preview)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gemini-2.5-pro',\n name: 'Gemini 2.5 Pro',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gemini-2.5-flash',\n name: 'Gemini 2.5 Flash',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gemini-1.5-pro-latest',\n name: 'Gemini 1.5 Pro (Latest)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gemini-1.5-flash-latest',\n name: 'Gemini 1.5 Flash (Latest)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n\n // Image models\n {\n id: 'imagen-3.0-generate-002',\n name: 'Imagen 3 (Fast)',\n enabled: true,\n useCase: 'image',\n },\n {\n id: 'gemini-2.5-flash-image',\n name: 'Gemini 2.5 Flash Image',\n enabled: true,\n responseModalities: ['IMAGE'],\n useCase: 'image',\n },\n {\n id: 'gemini-3-pro-image-preview',\n name: 'Gemini 3.0 Pro Image (Preview)',\n enabled: true,\n responseModalities: ['IMAGE'],\n useCase: 'image',\n },\n\n // TTS Models\n {\n id: 'gemini-2.5-pro-preview-tts',\n name: 'Gemini 2.5 Pro TTS (Preview)',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n {\n id: 'gemini-2.5-flash-preview-tts',\n name: 'Gemini 2.5 Flash TTS (Preview)',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n ],\n fields: [\n // Basic model info\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description:\n 'Exact model id as used with @ai-sdk/google.',\n width: '33%',\n },\n label: 'Model ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '33%',\n },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'useCase',\n type: 'select',\n admin: {\n width: '33%',\n },\n dbName: 'google-model-useCase',\n defaultValue: 'text',\n label: 'Use Case',\n options: [\n { label: 'Text', value: 'text' },\n { label: 'Image Generation', value: 'image' },\n { label: 'Text-to-Speech', value: 'tts' },\n { label: 'Embeddings', value: 'embedding' },\n ],\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: 'google-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 labels: {\n plural: 'Models',\n singular: 'Model',\n },\n },\n ],\n label: 'Models',\n },\n ],\n },\n ],\n imageURL: GoogleIcon,\n labels: {\n plural: 'Google Providers',\n singular: 'Google Gemini',\n },\n}\n"],"names":["GoogleIcon","googleBlock","slug","custom","providerOptionsSchemas","image","fields","text","tts","type","tabs","name","defaultValue","label","admin","components","Field","description","required","initCollapsed","width","id","enabled","max","min","dbName","options","value","RowLabel","responseModalities","useCase","hasMany","labels","plural","singular","imageURL"],"mappings":"AAEA,SAASA,UAAU,QAAQ,cAAa;AAExC,OAAO,MAAMC,cAAqB;IAChCC,MAAM;IACNC,QAAQ;QACNC,wBAAwB;YACtBC,OAAO;gBACLC,QAAQ;oBAAC;oBAAe;oBAAoB;oBAAQ;iBAAe;YACrE;YACAC,MAAM;gBACJD,QAAQ;oBAAC;oBAAe;oBAAmB;oBAAQ;oBAAQ;iBAAiB;YAC9E;YACAE,KAAK;gBACHF,QAAQ;oBAAC;oBAAS;oBAAgB;iBAAe;YACnD;QACF;IACF;IACAA,QAAQ;QACN;YACEG,MAAM;YACNC,MAAM;gBACJ,eAAe;gBACf;oBACEJ,QAAQ;wBACN;4BACEK,MAAM;4BACNF,MAAM;4BACNG,cAAc;4BACdC,OAAO;wBACT;wBACA;4BACEF,MAAM;4BACNF,MAAM;4BACNK,OAAO;gCACLC,YAAY;oCACVC,OAAO;gCACT;gCACAC,aACE;4BACJ;4BACAJ,OAAO;4BACPK,UAAU;wBACZ;qBACD;oBACDL,OAAO;gBACT;gBAEA,oBAAoB;gBACpB;oBACEP,QAAQ;wBACN;4BACEG,MAAM;4BACNK,OAAO;gCACLK,eAAe;4BACjB;4BACAb,QAAQ;gCACN;oCACEG,MAAM;oCACNH,QAAQ;wCACN;4CACEK,MAAM;4CACNF,MAAM;4CACNK,OAAO;gDACLG,aACE;4CACJ;4CACAJ,OAAO;wCACT;qCACD;gCACH;gCACA;oCACEF,MAAM;oCACNF,MAAM;oCACNK,OAAO;wCACLG,aACE;oCACJ;oCACAX,QAAQ;wC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4CACEP,MAAM;4CACNF,MAAM;4CACNK,OAAO;gDACLM,OAAO;4CACT;4CACAK,QAAQ;4CACRb,cAAc;4CACdC,OAAO;4CACPa,SAAS;gDACP;oDAAEb,OAAO;oDAAQc,OAAO;gDAAO;gDAC/B;oDAAEd,OAAO;oDAAoBc,OAAO;gDAAQ;gDAC5C;oDAAEd,OAAO;oDAAkBc,OAAO;gDAAM;gDACxC;oDAAEd,OAAO;oDAAcc,OAAO;gDAAY;6CAC3C;wCACH;qCACD;gCACH;gCACA;oCACEhB,MAAM;oCACNF,MAAM;oCACNK,OAAO;wCACLG,aAAa;wCACbG,OAAO;oCACT;oCACAK,QAAQ;oCACRM,SAAS;oCACTlB,OAAO;oCACPa,SAAS;wCACP;4CAAEb,OAAO;4CAAQc,OAAO;wCAAO;wCAC/B;4CAAEd,OAAO;4CAASc,OAAO;wCAAQ;wCACjC;4CAAEd,OAAO;4CAASc,OAAO;wCAAQ;qCAClC;gCACH;gCACA;oCACEhB,MAAM;oCACNF,MAAM;oCACNK,OAAO;wCACLM,OAAO;oCACT;oCACAR,cAAc;oCACdC,OAAO;gCACT;6BACD;4BACDA,OAAO;4BACPmB,QAAQ;gCACNC,QAAQ;gCACRC,UAAU;4BACZ;wBACF;qBACD;oBACDrB,OAAO;gBACT;aACD;QACH;KACD;IACDsB,UAAUnC;IACVgC,QAAQ;QACNC,QAAQ;QACRC,UAAU;IACZ;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/ai/providers/blocks/google.ts"],"sourcesContent":["import type { Block } from 'payload'\n\nimport { GoogleIcon } from '../icons.js'\n\nexport const googleBlock: Block = {\n slug: 'google',\n custom: {\n providerOptionsSchemas: {\n image: {\n fields: ['aspectRatio', 'personGeneration', 'seed', 'addWatermark'],\n },\n text: {\n fields: ['temperature', 'maxOutputTokens', 'topP', 'topK', 'safetySettings'],\n },\n tts: {\n fields: ['speed', 'volumeGainDb', 'speakingRate'],\n },\n },\n },\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:\n 'Optional. If empty, @ai-sdk/google will use the GOOGLE_GENERATIVE_AI_API_KEY environment variable.',\n },\n label: 'API Key',\n required: false,\n },\n ],\n label: 'Setup',\n },\n\n // 2. Connection tab\n {\n fields: [\n {\n type: 'collapsible',\n admin: {\n initCollapsed: false,\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'baseURL',\n type: 'text',\n admin: {\n description:\n 'Optional. Override default API endpoint (defaults to https://generativelanguage.googleapis.com/v1beta).',\n },\n label: 'Base URL',\n },\n ],\n },\n {\n name: 'headers',\n type: 'array',\n admin: {\n description:\n 'Optional. Extra headers to send with every request, for example routing through a proxy.',\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'key',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Name',\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Value',\n required: true,\n },\n ],\n },\n ],\n label: 'Custom Headers',\n },\n ],\n label: 'API & Network Settings',\n },\n ],\n label: 'Connection',\n },\n\n // 3. Voices tab (NEW)\n {\n fields: [\n {\n name: 'voices',\n type: 'array',\n admin: {\n description: 'Available voices for Gemini TTS models.',\n initCollapsed: false,\n },\n defaultValue: [\n { id: 'Puck', name: 'Puck (Upbeat)', enabled: true },\n { id: 'Charon', name: 'Charon (Informative)', enabled: true },\n { id: 'Kore', name: 'Kore (Firm)', enabled: true },\n { id: 'Fenrir', name: 'Fenrir (Excitable)', enabled: true },\n { id: 'Aoede', name: 'Aoede (Breezy)', enabled: true },\n { id: 'Zephyr', name: 'Zephyr (Bright)', enabled: true },\n ],\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'Voice ID used by Google API',\n width: '40%',\n },\n label: 'Voice ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '40%',\n },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'enabled',\n type: 'checkbox',\n admin: {\n width: '20%',\n },\n defaultValue: true,\n label: 'Enabled',\n },\n ],\n },\n ],\n label: 'Available Voices',\n },\n ],\n label: 'Voices',\n },\n\n // 4. Provider Options (NEW - One group per use case)\n {\n fields: [\n // TTS Settings\n {\n name: 'ttsProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for TTS models.',\n },\n fields: [\n {\n name: 'speed',\n type: 'number',\n defaultValue: 1.0,\n label: 'Speaking Rate',\n max: 4.0,\n min: 0.25,\n },\n {\n name: 'volumeGainDb',\n type: 'number',\n defaultValue: 0,\n label: 'Volume Gain (dB)',\n },\n ],\n label: 'TTS Provider Options',\n },\n\n // Image Settings\n {\n name: 'imageProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for image generation models.',\n },\n fields: [\n {\n name: 'aspectRatio',\n type: 'select',\n dbName: 'google-image-aspectRatio',\n defaultValue: '1:1',\n label: 'Default Aspect Ratio',\n options: [\n { label: '1:1 (Square)', value: '1:1' },\n { label: '16:9 (Landscape)', value: '16:9' },\n { label: '9:16 (Portrait)', value: '9:16' },\n { label: '4:3', value: '4:3' },\n { label: '3:4', value: '3:4' },\n ],\n },\n {\n name: 'personGeneration',\n type: 'select',\n dbName: 'google-image-personGeneration',\n defaultValue: 'allow_adult',\n label: 'Person Generation (Imagen)',\n options: [\n { label: 'Allow Adults Only', value: 'allow_adult' },\n { label: 'Allow All', value: 'allow_all' },\n { label: 'Do Not Allow', value: 'dont_allow' },\n ],\n },\n {\n name: 'addWatermark',\n type: 'checkbox',\n defaultValue: true,\n label: 'Add SynthID Watermark',\n },\n ],\n label: 'Image Provider Options',\n },\n\n // Text Settings\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: 2.0,\n min: 0.0,\n },\n {\n name: 'maxOutputTokens',\n type: 'number',\n label: 'Max Output Tokens',\n },\n {\n name: 'topP',\n type: 'number',\n defaultValue: 0.95,\n label: 'Top P',\n max: 1.0,\n min: 0.0,\n },\n {\n name: 'topK',\n type: 'number',\n defaultValue: 40,\n label: 'Top K',\n },\n {\n name: 'safetySettings',\n type: 'array',\n admin: {\n description: 'Safety filter settings',\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'category',\n type: 'select',\n admin: {\n width: '50%',\n },\n dbName: 'google-safety-category',\n label: 'Category',\n options: [\n { label: 'Harassment', value: 'HARM_CATEGORY_HARASSMENT' },\n { label: 'Hate Speech', value: 'HARM_CATEGORY_HATE_SPEECH' },\n {\n label: 'Sexually Explicit',\n value: 'HARM_CATEGORY_SEXUALLY_EXPLICIT',\n },\n {\n label: 'Dangerous Content',\n value: 'HARM_CATEGORY_DANGEROUS_CONTENT',\n },\n ],\n required: true,\n },\n {\n name: 'threshold',\n type: 'select',\n admin: {\n width: '50%',\n },\n dbName: 'google-safety-threshold',\n label: 'Threshold',\n options: [\n { label: 'Block None', value: 'BLOCK_NONE' },\n { label: 'Block Low+', value: 'BLOCK_LOW_AND_ABOVE' },\n { label: 'Block Medium+', value: 'BLOCK_MEDIUM_AND_ABOVE' },\n { label: 'Block High', value: 'BLOCK_ONLY_HIGH' },\n ],\n required: true,\n },\n ],\n },\n ],\n label: 'Default Safety Settings',\n },\n ],\n label: 'Text Provider Options',\n },\n ],\n label: 'Provider Options',\n },\n\n // 5. Models tab (Simplified)\n {\n fields: [\n {\n name: 'models',\n type: 'array',\n admin: {\n components: {\n RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel',\n },\n description: 'Keep this list short. Enable only the models you actually use.',\n initCollapsed: true,\n },\n defaultValue: [\n // Text models\n {\n id: 'gemini-3-pro-preview',\n name: 'Gemini 3.0 Pro (Preview)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gemini-2.5-pro',\n name: 'Gemini 2.5 Pro',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gemini-2.5-flash',\n name: 'Gemini 2.5 Flash',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gemini-1.5-pro-latest',\n name: 'Gemini 1.5 Pro (Latest)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gemini-1.5-flash-latest',\n name: 'Gemini 1.5 Flash (Latest)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n\n // Image models\n {\n id: 'gemini-2.5-flash-image',\n name: 'Gemini 2.5 Flash Image',\n enabled: true,\n responseModalities: ['IMAGE'],\n useCase: 'image',\n },\n {\n id: 'imagen-4.0-generate-001',\n name: 'Imagen 4',\n enabled: true,\n // TODO: fix this with proper definition for multimodel or image model only\n responseModalities: ['IMAGE'],\n useCase: 'image',\n },\n {\n id: 'gemini-3-pro-image-preview',\n name: 'Gemini 3.0 Pro Image (Preview)',\n enabled: true,\n responseModalities: ['IMAGE'],\n useCase: 'image',\n },\n\n // TTS Models\n {\n id: 'gemini-2.5-pro-preview-tts',\n name: 'Gemini 2.5 Pro TTS (Preview)',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n {\n id: 'gemini-2.5-flash-preview-tts',\n name: 'Gemini 2.5 Flash TTS (Preview)',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n ],\n fields: [\n // Basic model info\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'Exact model id as used with @ai-sdk/google.',\n width: '33%',\n },\n label: 'Model ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '33%',\n },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'useCase',\n type: 'select',\n admin: {\n width: '33%',\n },\n dbName: 'google-model-useCase',\n defaultValue: 'text',\n label: 'Use Case',\n options: [\n { label: 'Text', value: 'text' },\n { label: 'Image Generation', value: 'image' },\n { label: 'Text-to-Speech', value: 'tts' },\n { label: 'Embeddings', value: 'embedding' },\n ],\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: 'google-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 labels: {\n plural: 'Models',\n singular: 'Model',\n },\n },\n ],\n label: 'Models',\n },\n ],\n },\n ],\n imageURL: GoogleIcon,\n labels: {\n plural: 'Google Providers',\n singular: 'Google Gemini',\n },\n}\n"],"names":["GoogleIcon","googleBlock","slug","custom","providerOptionsSchemas","image","fields","text","tts","type","tabs","name","defaultValue","label","admin","components","Field","description","required","initCollapsed","width","id","enabled","max","min","dbName","options","value","RowLabel","responseModalities","useCase","hasMany","labels","plural","singular","imageURL"],"mappings":"AAEA,SAASA,UAAU,QAAQ,cAAa;AAExC,OAAO,MAAMC,cAAqB;IAChCC,MAAM;IACNC,QAAQ;QACNC,wBAAwB;YACtBC,OAAO;gBACLC,QAAQ;oBAAC;oBAAe;oBAAoB;oBAAQ;iBAAe;YACrE;YACAC,MAAM;gBACJD,QAAQ;oBAAC;oBAAe;oBAAmB;oBAAQ;oBAAQ;iBAAiB;YAC9E;YACAE,KAAK;gBACHF,QAAQ;oBAAC;oBAAS;oBAAgB;iBAAe;YACnD;QACF;IACF;IACAA,QAAQ;QACN;YACEG,MAAM;YACNC,MAAM;gBACJ,eAAe;gBACf;oBACEJ,QAAQ;wBACN;4BACEK,MAAM;4BACNF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,OAAO;gCACT;6BACD;4BACDA,OAAO;4BACPmB,QAAQ;gCACNC,QAAQ;gCACRC,UAAU;4BACZ;wBACF;qBACD;oBACDrB,OAAO;gBACT;aACD;QACH;KACD;IACDsB,UAAUnC;IACVgC,QAAQ;QACNC,QAAQ;QACRC,UAAU;IACZ;AACF,EAAC"}
|
|
@@ -405,7 +405,7 @@ export const openaiBlock = {
|
|
|
405
405
|
RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel'
|
|
406
406
|
},
|
|
407
407
|
description: 'Keep this list short. Enable only the models you actually use.',
|
|
408
|
-
initCollapsed:
|
|
408
|
+
initCollapsed: true
|
|
409
409
|
},
|
|
410
410
|
label: 'Available Models',
|
|
411
411
|
labels: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/ai/providers/blocks/openai.ts"],"sourcesContent":["import type { Block } from 'payload'\n\n\nimport { OpenAIIcon } from '../icons.js'\n\nexport const openaiBlock: Block = {\n slug: 'openai',\n custom: {\n providerOptionsSchemas: {\n image: {\n fields: ['quality', 'style'],\n },\n text: {\n fields: [\n 'temperature',\n 'max_tokens',\n 'top_p',\n 'frequency_penalty',\n 'presence_penalty',\n 'seed',\n 'logitBias',\n ],\n },\n tts: {\n fields: ['speed', 'response_format', 'instructions'],\n },\n },\n },\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:\n 'Optional. If empty, @ai-sdk/openai will use the OPENAI_API_KEY environment variable.',\n },\n label: 'API Key',\n required: false,\n },\n ],\n label: 'Setup',\n },\n\n // 2. Connection tab\n {\n fields: [\n {\n type: 'collapsible',\n admin: {\n initCollapsed: false,\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'baseURL',\n type: 'text',\n admin: {\n description:\n 'Optional. Override default API endpoint (defaults to https://api.openai.com/v1).',\n },\n defaultValue: 'https://api.openai.com/v1',\n label: 'Base URL',\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'organization',\n type: 'text',\n admin: {\n description:\n 'Optional. OpenAI organization ID for billing and access control.',\n },\n label: 'Organization ID',\n },\n {\n name: 'project',\n type: 'text',\n admin: {\n description: 'Optional. OpenAI project ID for organization-level access.',\n },\n label: 'Project ID',\n },\n ],\n },\n {\n name: 'headers',\n type: 'array',\n admin: {\n description:\n 'Optional. Extra headers to send with every request, for example routing through a proxy.',\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'key',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Name',\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Value',\n required: true,\n },\n ],\n },\n ],\n label: 'Custom Headers',\n },\n ],\n label: 'API & Network Settings',\n },\n ],\n label: 'Connection',\n },\n\n // 3. Voices tab (NEW)\n {\n fields: [\n {\n name: 'voices',\n type: 'array',\n admin: {\n description: 'Available voices for Text-to-Speech models. You can add custom voices here.',\n initCollapsed: false,\n },\n defaultValue: [\n { id: 'alloy', name: 'Alloy', enabled: true },\n { id: 'echo', name: 'Echo', enabled: true },\n { id: 'fable', name: 'Fable', enabled: true },\n { id: 'onyx', name: 'Onyx', enabled: true },\n { id: 'nova', name: 'Nova', enabled: true },\n { id: 'shimmer', name: 'Shimmer', enabled: true },\n ],\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'Voice ID as used by OpenAI API',\n width: '40%',\n },\n label: 'Voice ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '40%',\n },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'enabled',\n type: 'checkbox',\n admin: {\n width: '20%',\n },\n defaultValue: true,\n label: 'Enabled',\n },\n ],\n },\n ],\n label: 'Available Voices',\n },\n ],\n label: 'Voices',\n },\n\n // 4. Provider Options (NEW - One group per use case)\n {\n fields: [\n // TTS Provider Options\n {\n name: 'ttsProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for TTS models. Users can override these per field.',\n },\n fields: [\n {\n name: 'speed',\n type: 'number',\n defaultValue: 1.0,\n label: 'Default Speed',\n max: 4,\n min: 0.25,\n },\n {\n name: 'response_format',\n type: 'select',\n dbName: \"openai-tts-response_format\",\n defaultValue: 'mp3',\n label: 'Default Response Format',\n options: [\n { label: 'MP3', value: 'mp3' },\n { label: 'Opus', value: 'opus' },\n { label: 'AAC', value: 'aac' },\n { label: 'FLAC', value: 'flac' },\n { label: 'WAV', value: 'wav' },\n { label: 'PCM', value: 'pcm' },\n ],\n },\n {\n name: 'instructions',\n type: 'textarea',\n admin: {\n placeholder: 'Optional default voice instructions',\n },\n label: 'Default Instructions',\n },\n ],\n label: 'TTS Provider Options',\n },\n\n // Image Provider Options\n {\n name: 'imageProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for image generation models.',\n },\n fields: [\n {\n name: 'quality',\n type: 'select',\n dbName: 'openai-image-quality',\n defaultValue: 'standard',\n label: 'Default Quality',\n options: [\n { label: 'Standard', value: 'standard' },\n { label: 'HD', value: 'hd' },\n ],\n },\n {\n name: 'style',\n type: 'select',\n dbName: 'openai-image-style',\n defaultValue: 'vivid',\n label: 'Default Style',\n options: [\n { label: 'Vivid', value: 'vivid' },\n { label: 'Natural', value: 'natural' },\n ],\n },\n ],\n label: 'Image Provider Options',\n },\n\n // Text Provider Options\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: 2,\n min: 0,\n },\n {\n name: 'max_tokens',\n type: 'number',\n label: 'Default Max Tokens',\n },\n {\n name: 'top_p',\n type: 'number',\n defaultValue: 1.0,\n label: 'Default Top P',\n max: 1,\n min: 0,\n },\n {\n name: 'frequency_penalty',\n type: 'number',\n defaultValue: 0,\n label: 'Default Frequency Penalty',\n max: 2,\n min: -2,\n },\n {\n name: 'presence_penalty',\n type: 'number',\n defaultValue: 0,\n label: 'Default Presence Penalty',\n max: 2,\n min: -2,\n },\n {\n name: 'seed',\n type: 'number',\n label: 'Default Seed',\n },\n {\n name: 'logitBias',\n type: 'json',\n admin: {\n description: 'Modify likelihood of tokens (JSON object mapping token IDs to bias).',\n },\n label: 'Default Logit Bias',\n },\n ],\n label: 'Text Provider Options',\n },\n ],\n label: 'Provider Options',\n },\n\n // 5. Models (SIMPLIFIED - no per-model settings)\n {\n fields: [\n {\n name: 'models',\n type: 'array',\n admin: {\n components: {\n RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel',\n },\n description: 'Keep this list short. Enable only the models you actually use.',\n initCollapsed: false,\n },\n label: 'Available Models',\n labels: {\n plural: 'Models',\n singular: 'Model',\n },\n // Curated models for content creation platforms\n defaultValue: [\n // ===== Text Generation =====\n {\n id: 'gpt-5',\n name: 'GPT-5 (Latest Flagship)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gpt-5-mini',\n name: 'GPT-5 Mini (Fast & Efficient)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'chatgpt-4o-latest',\n name: 'ChatGPT-4o (Always Updated)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gpt-4o',\n name: 'GPT-4o (Multimodal)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gpt-4o-mini',\n name: 'GPT-4o Mini (Best Value)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gpt-4-turbo',\n name: 'GPT-4 Turbo',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n\n // ===== Image Generation =====\n {\n id: 'gpt-image-1',\n name: 'GPT Image 1 (Latest)',\n enabled: true,\n useCase: 'image',\n },\n {\n id: 'dall-e-3',\n name: 'DALL-E 3',\n enabled: true,\n useCase: 'image',\n },\n\n // ===== Audio =====\n {\n id: 'tts-1-hd',\n name: 'TTS HD (Text-to-Speech)',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n ],\n fields: [\n // Basic model info\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description:\n 'Exact model id as used with @ai-sdk/openai, for example gpt-4o.',\n width: '33%',\n },\n label: 'Model ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '33%',\n },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'useCase',\n type: 'select',\n admin: {\n width: '33%',\n },\n dbName: 'openai-model-useCase',\n defaultValue: 'text',\n label: 'Use Case',\n options: [\n { label: 'Text', value: 'text' },\n { label: 'Image Generation', value: 'image' },\n { label: 'Text-to-Speech', value: 'tts' },\n { label: 'Embeddings', value: 'embedding' },\n ],\n },\n ],\n },\n // Response modalities and enabled checkbox\n {\n name: 'responseModalities',\n type: 'select',\n admin: {\n description: 'Output capabilities of this model',\n width: '50%',\n },\n dbName: 'openai-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 },\n ],\n label: 'Models',\n },\n ],\n },\n ],\n imageURL: OpenAIIcon,\n labels: {\n plural: 'OpenAI Providers',\n singular: 'OpenAI',\n },\n}\n"],"names":["OpenAIIcon","openaiBlock","slug","custom","providerOptionsSchemas","image","fields","text","tts","type","tabs","name","defaultValue","label","admin","components","Field","description","required","initCollapsed","width","id","enabled","max","min","dbName","options","value","placeholder","RowLabel","labels","plural","singular","responseModalities","useCase","hasMany","imageURL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P;4CAAEb,OAAO;4CAAQc,OAAO;wCAAO;wCAC/B;4CAAEd,OAAO;4CAASc,OAAO;wCAAQ;wCACjC;4CAAEd,OAAO;4CAASc,OAAO;wCAAQ;qCAClC;gCACH;gCACA;oCACEhB,MAAM;oCACNF,MAAM;oCACNK,OAAO;wCACLM,OAAO;oCACT;oCACAR,cAAc;oCACdC,OAAO;gCACT;6BACD;wBACH;qBACD;oBACDA,OAAO;gBACT;aACD;QACH;KACD;IACDuB,UAAUpC;IACV8B,QAAQ;QACNC,QAAQ;QACRC,UAAU;IACZ;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/ai/providers/blocks/openai.ts"],"sourcesContent":["import type { Block } from 'payload'\n\n\nimport { OpenAIIcon } from '../icons.js'\n\nexport const openaiBlock: Block = {\n slug: 'openai',\n custom: {\n providerOptionsSchemas: {\n image: {\n fields: ['quality', 'style'],\n },\n text: {\n fields: [\n 'temperature',\n 'max_tokens',\n 'top_p',\n 'frequency_penalty',\n 'presence_penalty',\n 'seed',\n 'logitBias',\n ],\n },\n tts: {\n fields: ['speed', 'response_format', 'instructions'],\n },\n },\n },\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:\n 'Optional. If empty, @ai-sdk/openai will use the OPENAI_API_KEY environment variable.',\n },\n label: 'API Key',\n required: false,\n },\n ],\n label: 'Setup',\n },\n\n // 2. Connection tab\n {\n fields: [\n {\n type: 'collapsible',\n admin: {\n initCollapsed: false,\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'baseURL',\n type: 'text',\n admin: {\n description:\n 'Optional. Override default API endpoint (defaults to https://api.openai.com/v1).',\n },\n defaultValue: 'https://api.openai.com/v1',\n label: 'Base URL',\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'organization',\n type: 'text',\n admin: {\n description:\n 'Optional. OpenAI organization ID for billing and access control.',\n },\n label: 'Organization ID',\n },\n {\n name: 'project',\n type: 'text',\n admin: {\n description: 'Optional. OpenAI project ID for organization-level access.',\n },\n label: 'Project ID',\n },\n ],\n },\n {\n name: 'headers',\n type: 'array',\n admin: {\n description:\n 'Optional. Extra headers to send with every request, for example routing through a proxy.',\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'key',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Name',\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Header Value',\n required: true,\n },\n ],\n },\n ],\n label: 'Custom Headers',\n },\n ],\n label: 'API & Network Settings',\n },\n ],\n label: 'Connection',\n },\n\n // 3. Voices tab (NEW)\n {\n fields: [\n {\n name: 'voices',\n type: 'array',\n admin: {\n description: 'Available voices for Text-to-Speech models. You can add custom voices here.',\n initCollapsed: false,\n },\n defaultValue: [\n { id: 'alloy', name: 'Alloy', enabled: true },\n { id: 'echo', name: 'Echo', enabled: true },\n { id: 'fable', name: 'Fable', enabled: true },\n { id: 'onyx', name: 'Onyx', enabled: true },\n { id: 'nova', name: 'Nova', enabled: true },\n { id: 'shimmer', name: 'Shimmer', enabled: true },\n ],\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description: 'Voice ID as used by OpenAI API',\n width: '40%',\n },\n label: 'Voice ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '40%',\n },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'enabled',\n type: 'checkbox',\n admin: {\n width: '20%',\n },\n defaultValue: true,\n label: 'Enabled',\n },\n ],\n },\n ],\n label: 'Available Voices',\n },\n ],\n label: 'Voices',\n },\n\n // 4. Provider Options (NEW - One group per use case)\n {\n fields: [\n // TTS Provider Options\n {\n name: 'ttsProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for TTS models. Users can override these per field.',\n },\n fields: [\n {\n name: 'speed',\n type: 'number',\n defaultValue: 1.0,\n label: 'Default Speed',\n max: 4,\n min: 0.25,\n },\n {\n name: 'response_format',\n type: 'select',\n dbName: \"openai-tts-response_format\",\n defaultValue: 'mp3',\n label: 'Default Response Format',\n options: [\n { label: 'MP3', value: 'mp3' },\n { label: 'Opus', value: 'opus' },\n { label: 'AAC', value: 'aac' },\n { label: 'FLAC', value: 'flac' },\n { label: 'WAV', value: 'wav' },\n { label: 'PCM', value: 'pcm' },\n ],\n },\n {\n name: 'instructions',\n type: 'textarea',\n admin: {\n placeholder: 'Optional default voice instructions',\n },\n label: 'Default Instructions',\n },\n ],\n label: 'TTS Provider Options',\n },\n\n // Image Provider Options\n {\n name: 'imageProviderOptions',\n type: 'group',\n admin: {\n description: 'Default provider options for image generation models.',\n },\n fields: [\n {\n name: 'quality',\n type: 'select',\n dbName: 'openai-image-quality',\n defaultValue: 'standard',\n label: 'Default Quality',\n options: [\n { label: 'Standard', value: 'standard' },\n { label: 'HD', value: 'hd' },\n ],\n },\n {\n name: 'style',\n type: 'select',\n dbName: 'openai-image-style',\n defaultValue: 'vivid',\n label: 'Default Style',\n options: [\n { label: 'Vivid', value: 'vivid' },\n { label: 'Natural', value: 'natural' },\n ],\n },\n ],\n label: 'Image Provider Options',\n },\n\n // Text Provider Options\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: 2,\n min: 0,\n },\n {\n name: 'max_tokens',\n type: 'number',\n label: 'Default Max Tokens',\n },\n {\n name: 'top_p',\n type: 'number',\n defaultValue: 1.0,\n label: 'Default Top P',\n max: 1,\n min: 0,\n },\n {\n name: 'frequency_penalty',\n type: 'number',\n defaultValue: 0,\n label: 'Default Frequency Penalty',\n max: 2,\n min: -2,\n },\n {\n name: 'presence_penalty',\n type: 'number',\n defaultValue: 0,\n label: 'Default Presence Penalty',\n max: 2,\n min: -2,\n },\n {\n name: 'seed',\n type: 'number',\n label: 'Default Seed',\n },\n {\n name: 'logitBias',\n type: 'json',\n admin: {\n description: 'Modify likelihood of tokens (JSON object mapping token IDs to bias).',\n },\n label: 'Default Logit Bias',\n },\n ],\n label: 'Text Provider Options',\n },\n ],\n label: 'Provider Options',\n },\n\n // 5. Models (SIMPLIFIED - no per-model settings)\n {\n fields: [\n {\n name: 'models',\n type: 'array',\n admin: {\n components: {\n RowLabel: '@ai-stack/payloadcms/client#ModelRowLabel',\n },\n description: 'Keep this list short. Enable only the models you actually use.',\n initCollapsed: true,\n },\n label: 'Available Models',\n labels: {\n plural: 'Models',\n singular: 'Model',\n },\n // Curated models for content creation platforms\n defaultValue: [\n // ===== Text Generation =====\n {\n id: 'gpt-5',\n name: 'GPT-5 (Latest Flagship)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gpt-5-mini',\n name: 'GPT-5 Mini (Fast & Efficient)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'chatgpt-4o-latest',\n name: 'ChatGPT-4o (Always Updated)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gpt-4o',\n name: 'GPT-4o (Multimodal)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gpt-4o-mini',\n name: 'GPT-4o Mini (Best Value)',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n {\n id: 'gpt-4-turbo',\n name: 'GPT-4 Turbo',\n enabled: true,\n responseModalities: ['TEXT'],\n useCase: 'text',\n },\n\n // ===== Image Generation =====\n {\n id: 'gpt-image-1',\n name: 'GPT Image 1 (Latest)',\n enabled: true,\n useCase: 'image',\n },\n {\n id: 'dall-e-3',\n name: 'DALL-E 3',\n enabled: true,\n useCase: 'image',\n },\n\n // ===== Audio =====\n {\n id: 'tts-1-hd',\n name: 'TTS HD (Text-to-Speech)',\n enabled: true,\n responseModalities: ['AUDIO'],\n useCase: 'tts',\n },\n ],\n fields: [\n // Basic model info\n {\n type: 'row',\n fields: [\n {\n name: 'id',\n type: 'text',\n admin: {\n description:\n 'Exact model id as used with @ai-sdk/openai, for example gpt-4o.',\n width: '33%',\n },\n label: 'Model ID',\n required: true,\n },\n {\n name: 'name',\n type: 'text',\n admin: {\n width: '33%',\n },\n label: 'Display Name',\n required: true,\n },\n {\n name: 'useCase',\n type: 'select',\n admin: {\n width: '33%',\n },\n dbName: 'openai-model-useCase',\n defaultValue: 'text',\n label: 'Use Case',\n options: [\n { label: 'Text', value: 'text' },\n { label: 'Image Generation', value: 'image' },\n { label: 'Text-to-Speech', value: 'tts' },\n { label: 'Embeddings', value: 'embedding' },\n ],\n },\n ],\n },\n // Response modalities and enabled checkbox\n {\n name: 'responseModalities',\n type: 'select',\n admin: {\n description: 'Output capabilities of this model',\n width: '50%',\n },\n dbName: 'openai-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 },\n ],\n label: 'Models',\n },\n ],\n },\n ],\n imageURL: OpenAIIcon,\n labels: {\n plural: 'OpenAI Providers',\n singular: 'OpenAI',\n },\n}\n"],"names":["OpenAIIcon","openaiBlock","slug","custom","providerOptionsSchemas","image","fields","text","tts","type","tabs","name","defaultValue","label","admin","components","Field","description","required","initCollapsed","width","id","enabled","max","min","dbName","options","value","placeholder","RowLabel","labels","plural","singular","responseModalities","useCase","hasMany","imageURL"],"mappings":"AAGA,SAASA,UAAU,QAAQ,cAAa;AAExC,OAAO,MAAMC,cAAqB;IAChCC,MAAM;IACNC,QAAQ;QACNC,wBAAwB;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ASc,OAAO;wCAAQ;qCAClC;gCACH;gCACA;oCACEhB,MAAM;oCACNF,MAAM;oCACNK,OAAO;wCACLM,OAAO;oCACT;oCACAR,cAAc;oCACdC,OAAO;gCACT;6BACD;wBACH;qBACD;oBACDA,OAAO;gBACT;aACD;QACH;KACD;IACDuB,UAAUpC;IACV8B,QAAQ;QACNC,QAAQ;QACRC,UAAU;IACZ;AACF,EAAC"}
|
|
@@ -20,11 +20,18 @@ export const aiSettingsGlobal = {
|
|
|
20
20
|
label: 'AI Providers',
|
|
21
21
|
required: true
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
name: 'enabledCollections',
|
|
25
|
+
type: 'json',
|
|
26
|
+
admin: {
|
|
27
|
+
hidden: true
|
|
28
|
+
}
|
|
29
|
+
},
|
|
23
30
|
{
|
|
24
31
|
name: 'defaults',
|
|
25
32
|
type: 'group',
|
|
26
33
|
admin: {
|
|
27
|
-
description: '
|
|
34
|
+
description: 'Please provide default provider/model behavior for each use case'
|
|
28
35
|
},
|
|
29
36
|
fields: [
|
|
30
37
|
{
|
|
@@ -119,7 +126,7 @@ export const aiSettingsGlobal = {
|
|
|
119
126
|
{
|
|
120
127
|
fields: [
|
|
121
128
|
{
|
|
122
|
-
name: '
|
|
129
|
+
name: 'tts',
|
|
123
130
|
type: 'group',
|
|
124
131
|
fields: [
|
|
125
132
|
{
|
|
@@ -142,6 +149,16 @@ export const aiSettingsGlobal = {
|
|
|
142
149
|
},
|
|
143
150
|
label: 'Default Model'
|
|
144
151
|
},
|
|
152
|
+
{
|
|
153
|
+
name: 'voice',
|
|
154
|
+
type: 'text',
|
|
155
|
+
admin: {
|
|
156
|
+
components: {
|
|
157
|
+
Field: '@ai-stack/payloadcms/client#DynamicVoiceSelect'
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
label: 'Default Voice'
|
|
161
|
+
},
|
|
145
162
|
{
|
|
146
163
|
name: 'options',
|
|
147
164
|
type: 'json',
|
|
@@ -157,12 +174,15 @@ export const aiSettingsGlobal = {
|
|
|
157
174
|
label: ''
|
|
158
175
|
}
|
|
159
176
|
],
|
|
160
|
-
label: '
|
|
177
|
+
label: 'Speech Generation'
|
|
161
178
|
},
|
|
162
179
|
{
|
|
180
|
+
admin: {
|
|
181
|
+
disabled: true
|
|
182
|
+
},
|
|
163
183
|
fields: [
|
|
164
184
|
{
|
|
165
|
-
name: '
|
|
185
|
+
name: 'video',
|
|
166
186
|
type: 'group',
|
|
167
187
|
fields: [
|
|
168
188
|
{
|
|
@@ -185,16 +205,6 @@ export const aiSettingsGlobal = {
|
|
|
185
205
|
},
|
|
186
206
|
label: 'Default Model'
|
|
187
207
|
},
|
|
188
|
-
{
|
|
189
|
-
name: 'voice',
|
|
190
|
-
type: 'text',
|
|
191
|
-
admin: {
|
|
192
|
-
components: {
|
|
193
|
-
Field: '@ai-stack/payloadcms/client#DynamicVoiceSelect'
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
label: 'Default Voice'
|
|
197
|
-
},
|
|
198
208
|
{
|
|
199
209
|
name: 'options',
|
|
200
210
|
type: 'json',
|
|
@@ -210,7 +220,7 @@ export const aiSettingsGlobal = {
|
|
|
210
220
|
label: ''
|
|
211
221
|
}
|
|
212
222
|
],
|
|
213
|
-
label: '
|
|
223
|
+
label: 'Video Generation'
|
|
214
224
|
}
|
|
215
225
|
]
|
|
216
226
|
}
|
|
@@ -219,6 +229,18 @@ export const aiSettingsGlobal = {
|
|
|
219
229
|
}
|
|
220
230
|
],
|
|
221
231
|
hooks: {
|
|
232
|
+
afterChange: [
|
|
233
|
+
async ({ doc, req })=>{
|
|
234
|
+
if (doc.enabledCollections && doc.enabledCollections.length > 0) {
|
|
235
|
+
const { seedProperties } = await import('../utilities/seedProperties.js');
|
|
236
|
+
await seedProperties({
|
|
237
|
+
enabledCollections: doc.enabledCollections,
|
|
238
|
+
req
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
return doc;
|
|
242
|
+
}
|
|
243
|
+
],
|
|
222
244
|
afterRead: [
|
|
223
245
|
async ({ context, doc, req })=>{
|
|
224
246
|
if (!req.payload.secret) {
|
|
@@ -254,10 +276,15 @@ export const aiSettingsGlobal = {
|
|
|
254
276
|
if (data.providers) {
|
|
255
277
|
data.providers = data.providers.map((provider)=>{
|
|
256
278
|
if (provider.apiKey) {
|
|
257
|
-
|
|
279
|
+
const originalProvider = originalDoc?.providers?.find((p)=>p.id === provider.id);
|
|
280
|
+
// If the key strictly equals the existing one (e.g. partial update merge), do nothing.
|
|
281
|
+
// This prevents re-encrypting an already encrypted key.
|
|
282
|
+
if (originalProvider?.apiKey && provider.apiKey === originalProvider.apiKey) {
|
|
283
|
+
return provider;
|
|
284
|
+
}
|
|
285
|
+
// If it looks like a masked key, don't re-encrypt (it means it wasn't changed via UI)
|
|
258
286
|
if (provider.apiKey.startsWith('sk-') && provider.apiKey.includes('****')) {
|
|
259
287
|
// Restore the original encrypted key from originalDoc
|
|
260
|
-
const originalProvider = originalDoc?.providers?.find((p)=>p.id === provider.id);
|
|
261
288
|
if (originalProvider?.apiKey) {
|
|
262
289
|
provider.apiKey = originalProvider.apiKey;
|
|
263
290
|
}
|