n8n-nodes-pollinations-v2 1.2.28 → 1.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -3
- package/dist/nodes/Pollinations/Pollinations.node.d.ts +3 -0
- package/dist/nodes/Pollinations/Pollinations.node.js +183 -9
- package/dist/nodes/Pollinations/Pollinations.node.js.map +1 -1
- package/dist/nodes/Pollinations/operations/audioGeneration.js +8 -15
- package/dist/nodes/Pollinations/operations/audioGeneration.js.map +1 -1
- package/dist/nodes/Pollinations/operations/audioTranscription.d.ts +3 -0
- package/dist/nodes/Pollinations/operations/audioTranscription.js +146 -0
- package/dist/nodes/Pollinations/operations/audioTranscription.js.map +1 -0
- package/dist/nodes/Pollinations/operations/imageAnalysis.d.ts +3 -0
- package/dist/nodes/Pollinations/operations/imageAnalysis.js +135 -0
- package/dist/nodes/Pollinations/operations/imageAnalysis.js.map +1 -0
- package/dist/nodes/Pollinations/operations/imageGeneration.js +5 -0
- package/dist/nodes/Pollinations/operations/imageGeneration.js.map +1 -1
- package/dist/nodes/Pollinations/operations/imageToImage.d.ts +3 -0
- package/dist/nodes/Pollinations/operations/imageToImage.js +161 -0
- package/dist/nodes/Pollinations/operations/imageToImage.js.map +1 -0
- package/dist/nodes/Pollinations/operations/textGeneration.js +1 -0
- package/dist/nodes/Pollinations/operations/textGeneration.js.map +1 -1
- package/dist/nodes/Pollinations/operations/videoAnalysis.d.ts +3 -0
- package/dist/nodes/Pollinations/operations/videoAnalysis.js +136 -0
- package/dist/nodes/Pollinations/operations/videoAnalysis.js.map +1 -0
- package/dist/nodes/Pollinations/operations/videoGeneration.js +5 -0
- package/dist/nodes/Pollinations/operations/videoGeneration.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,12 +7,15 @@ This is an n8n community node for [Pollinations.ai](https://pollinations.ai) - a
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
9
|
- **Image Generation**: Create images using multiple AI models (Flux, Turbo, GPT Image, Kontext, and more)
|
|
10
|
+
- **Image Analysis**: Analyze and describe images using AI vision models
|
|
11
|
+
- **Image to Image**: Edit and transform images with AI
|
|
10
12
|
- **Video Generation**: Generate videos from text or images (Veo, Seedance models)
|
|
11
|
-
- **
|
|
13
|
+
- **Video Analysis**: Analyze video content with AI
|
|
14
|
+
- **Text Generation**: Use 25+ language models including OpenAI, Claude, Gemini, Mistral, and more
|
|
12
15
|
- **Audio Generation**: Convert text to speech with 13 different voices and 5 audio formats
|
|
13
|
-
- **
|
|
16
|
+
- **Audio Transcription**: Transcribe audio files to text using AI
|
|
17
|
+
- **Chat Model**: Use Pollinations models with n8m AI Agents, AI Chains, and AI workflows
|
|
14
18
|
- **OpenAI-Compatible**: Chat completions endpoint compatible with OpenAI API format
|
|
15
|
-
- **Vision Support**: Analyze and describe images using multimodal models
|
|
16
19
|
|
|
17
20
|
## Installation
|
|
18
21
|
|
|
@@ -133,6 +136,68 @@ Convert text to speech with multiple voices and formats.
|
|
|
133
136
|
|
|
134
137
|
**Audio Formats**: WAV, MP3, FLAC, Opus, PCM16
|
|
135
138
|
|
|
139
|
+
**Parameters**:
|
|
140
|
+
|
|
141
|
+
- Text (required)
|
|
142
|
+
- Voice selection
|
|
143
|
+
- Audio format
|
|
144
|
+
- **Advanced Options**:
|
|
145
|
+
- Model selection (default: openai-audio)
|
|
146
|
+
|
|
147
|
+
### Audio Transcription
|
|
148
|
+
|
|
149
|
+
Transcribe audio files to text using AI models with audio input capability.
|
|
150
|
+
|
|
151
|
+
**Models Available**: Gemini, Gemini Large, Gemini Legacy, OpenAI Audio
|
|
152
|
+
|
|
153
|
+
**Supported Formats**: MP3, WAV, FLAC, OGG, and more
|
|
154
|
+
|
|
155
|
+
**Parameters**:
|
|
156
|
+
|
|
157
|
+
- Binary Property (default: 'data') - Name of binary property containing audio
|
|
158
|
+
- Prompt (optional) - Instructions for transcription
|
|
159
|
+
- Model selection
|
|
160
|
+
|
|
161
|
+
### Image Analysis
|
|
162
|
+
|
|
163
|
+
Analyze and describe images using AI vision models.
|
|
164
|
+
|
|
165
|
+
**Models Available**: All vision-capable models (Gemini, Claude, OpenAI, etc.)
|
|
166
|
+
|
|
167
|
+
**Parameters**:
|
|
168
|
+
|
|
169
|
+
- Input Image (required) - Image file to analyze
|
|
170
|
+
- Prompt - What you want to know about the image
|
|
171
|
+
- Model selection
|
|
172
|
+
|
|
173
|
+
### Image to Image
|
|
174
|
+
|
|
175
|
+
Edit and transform images with AI-powered image-to-image generation.
|
|
176
|
+
|
|
177
|
+
**Models Available**: Kontext, and other models supporting image input/output
|
|
178
|
+
|
|
179
|
+
**Parameters**:
|
|
180
|
+
|
|
181
|
+
- Input Image (required) - Source image to edit
|
|
182
|
+
- Prompt (required) - Instructions for how to edit the image
|
|
183
|
+
- Model selection
|
|
184
|
+
- Negative Prompt - What to avoid in the generated image
|
|
185
|
+
- Seed - For reproducible results
|
|
186
|
+
|
|
187
|
+
### Video Analysis
|
|
188
|
+
|
|
189
|
+
Analyze video content and extract insights using AI models with video understanding.
|
|
190
|
+
|
|
191
|
+
**Models Available**: All video-capable models (Gemini, Claude, OpenAI, etc.)
|
|
192
|
+
|
|
193
|
+
**Supported Formats**: MP4, MOV, AVI, and more
|
|
194
|
+
|
|
195
|
+
**Parameters**:
|
|
196
|
+
|
|
197
|
+
- Video Input (required) - Video file to analyze
|
|
198
|
+
- Prompt - What you want to know about the video
|
|
199
|
+
- Model selection
|
|
200
|
+
|
|
136
201
|
## Chat Model (AI Agent Support)
|
|
137
202
|
|
|
138
203
|
Use Pollinations language models with n8n's AI Agent, AI Chain, and other AI workflow nodes.
|
|
@@ -6,6 +6,9 @@ export declare class Pollinations implements INodeType {
|
|
|
6
6
|
getImageModels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
7
7
|
getVideoModels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
8
8
|
getTextModels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
9
|
+
getVisionModels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
10
|
+
getImageToImageModels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
11
|
+
getVideoAnalysisModels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
9
12
|
};
|
|
10
13
|
};
|
|
11
14
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
@@ -6,6 +6,10 @@ const imageGeneration_1 = require("./operations/imageGeneration");
|
|
|
6
6
|
const videoGeneration_1 = require("./operations/videoGeneration");
|
|
7
7
|
const textGeneration_1 = require("./operations/textGeneration");
|
|
8
8
|
const audioGeneration_1 = require("./operations/audioGeneration");
|
|
9
|
+
const audioTranscription_1 = require("./operations/audioTranscription");
|
|
10
|
+
const imageAnalysis_1 = require("./operations/imageAnalysis");
|
|
11
|
+
const videoAnalysis_1 = require("./operations/videoAnalysis");
|
|
12
|
+
const imageToImage_1 = require("./operations/imageToImage");
|
|
9
13
|
class Pollinations {
|
|
10
14
|
constructor() {
|
|
11
15
|
this.description = {
|
|
@@ -29,11 +33,71 @@ class Pollinations {
|
|
|
29
33
|
},
|
|
30
34
|
],
|
|
31
35
|
properties: [
|
|
36
|
+
{
|
|
37
|
+
displayName: 'Resource',
|
|
38
|
+
name: 'resource',
|
|
39
|
+
type: 'options',
|
|
40
|
+
noDataExpression: true,
|
|
41
|
+
options: [
|
|
42
|
+
{
|
|
43
|
+
name: 'Audio',
|
|
44
|
+
value: 'audio',
|
|
45
|
+
description: 'Audio generation and transcription',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Image',
|
|
49
|
+
value: 'image',
|
|
50
|
+
description: 'Image generation, analysis, and editing',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Text',
|
|
54
|
+
value: 'text',
|
|
55
|
+
description: 'Text generation with AI language models',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'Video',
|
|
59
|
+
value: 'video',
|
|
60
|
+
description: 'Video generation and analysis',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
default: 'image',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
displayName: 'Operation',
|
|
67
|
+
name: 'operation',
|
|
68
|
+
type: 'options',
|
|
69
|
+
noDataExpression: true,
|
|
70
|
+
displayOptions: {
|
|
71
|
+
show: {
|
|
72
|
+
resource: ['audio'],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
options: [
|
|
76
|
+
{
|
|
77
|
+
name: 'Audio Generation',
|
|
78
|
+
value: 'audioGeneration',
|
|
79
|
+
description: 'Generate audio/speech from text',
|
|
80
|
+
action: 'Generate audio',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'Audio Transcription',
|
|
84
|
+
value: 'audioTranscription',
|
|
85
|
+
description: 'Transcribe audio to text',
|
|
86
|
+
action: 'Transcribe audio',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
default: 'audioGeneration',
|
|
90
|
+
},
|
|
32
91
|
{
|
|
33
92
|
displayName: 'Operation',
|
|
34
93
|
name: 'operation',
|
|
35
94
|
type: 'options',
|
|
36
95
|
noDataExpression: true,
|
|
96
|
+
displayOptions: {
|
|
97
|
+
show: {
|
|
98
|
+
resource: ['image'],
|
|
99
|
+
},
|
|
100
|
+
},
|
|
37
101
|
options: [
|
|
38
102
|
{
|
|
39
103
|
name: 'Image Generation',
|
|
@@ -42,30 +106,74 @@ class Pollinations {
|
|
|
42
106
|
action: 'Generate an image',
|
|
43
107
|
},
|
|
44
108
|
{
|
|
45
|
-
name: '
|
|
46
|
-
value: '
|
|
47
|
-
description: '
|
|
48
|
-
action: '
|
|
109
|
+
name: 'Image Analysis',
|
|
110
|
+
value: 'imageAnalysis',
|
|
111
|
+
description: 'Analyze images with AI vision',
|
|
112
|
+
action: 'Analyze image',
|
|
49
113
|
},
|
|
114
|
+
{
|
|
115
|
+
name: 'Image to Image',
|
|
116
|
+
value: 'imageToImage',
|
|
117
|
+
description: 'Edit or transform images with AI',
|
|
118
|
+
action: 'Transform image',
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
default: 'imageGeneration',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
displayName: 'Operation',
|
|
125
|
+
name: 'operation',
|
|
126
|
+
type: 'options',
|
|
127
|
+
noDataExpression: true,
|
|
128
|
+
displayOptions: {
|
|
129
|
+
show: {
|
|
130
|
+
resource: ['text'],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
options: [
|
|
50
134
|
{
|
|
51
135
|
name: 'Text Generation',
|
|
52
136
|
value: 'textGeneration',
|
|
53
137
|
description: 'Generate text using AI language models',
|
|
54
138
|
action: 'Generate text',
|
|
55
139
|
},
|
|
140
|
+
],
|
|
141
|
+
default: 'textGeneration',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
displayName: 'Operation',
|
|
145
|
+
name: 'operation',
|
|
146
|
+
type: 'options',
|
|
147
|
+
noDataExpression: true,
|
|
148
|
+
displayOptions: {
|
|
149
|
+
show: {
|
|
150
|
+
resource: ['video'],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
options: [
|
|
56
154
|
{
|
|
57
|
-
name: '
|
|
58
|
-
value: '
|
|
59
|
-
description: 'Generate
|
|
60
|
-
action: 'Generate
|
|
155
|
+
name: 'Video Generation',
|
|
156
|
+
value: 'videoGeneration',
|
|
157
|
+
description: 'Generate videos from text or images',
|
|
158
|
+
action: 'Generate a video',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: 'Video Analysis',
|
|
162
|
+
value: 'videoAnalysis',
|
|
163
|
+
description: 'Analyze videos with AI',
|
|
164
|
+
action: 'Analyze video',
|
|
61
165
|
},
|
|
62
166
|
],
|
|
63
|
-
default: '
|
|
167
|
+
default: 'videoGeneration',
|
|
64
168
|
},
|
|
65
169
|
...imageGeneration_1.imageGenerationOperation,
|
|
66
170
|
...videoGeneration_1.videoGenerationOperation,
|
|
67
171
|
...textGeneration_1.textGenerationOperation,
|
|
68
172
|
...audioGeneration_1.audioGenerationOperation,
|
|
173
|
+
...audioTranscription_1.audioTranscriptionOperation,
|
|
174
|
+
...imageAnalysis_1.imageAnalysisOperation,
|
|
175
|
+
...videoAnalysis_1.videoAnalysisOperation,
|
|
176
|
+
...imageToImage_1.imageToImageOperation,
|
|
69
177
|
],
|
|
70
178
|
};
|
|
71
179
|
this.methods = {
|
|
@@ -126,6 +234,60 @@ class Pollinations {
|
|
|
126
234
|
return [];
|
|
127
235
|
}
|
|
128
236
|
},
|
|
237
|
+
async getVisionModels() {
|
|
238
|
+
try {
|
|
239
|
+
const models = (await this.helpers.httpRequest({
|
|
240
|
+
method: 'GET',
|
|
241
|
+
url: 'https://gen.pollinations.ai/text/models',
|
|
242
|
+
}));
|
|
243
|
+
return models
|
|
244
|
+
.filter((m) => { var _a; return (_a = m.input_modalities) === null || _a === void 0 ? void 0 : _a.includes('image'); })
|
|
245
|
+
.map((m) => ({
|
|
246
|
+
name: m.name.charAt(0).toUpperCase() + m.name.slice(1).replace(/-/g, ' '),
|
|
247
|
+
value: m.name,
|
|
248
|
+
}))
|
|
249
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
return [];
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
async getImageToImageModels() {
|
|
256
|
+
try {
|
|
257
|
+
const models = (await this.helpers.httpRequest({
|
|
258
|
+
method: 'GET',
|
|
259
|
+
url: 'https://gen.pollinations.ai/image/models',
|
|
260
|
+
}));
|
|
261
|
+
return models
|
|
262
|
+
.filter((m) => { var _a, _b; return ((_a = m.input_modalities) === null || _a === void 0 ? void 0 : _a.includes('image')) && ((_b = m.output_modalities) === null || _b === void 0 ? void 0 : _b.includes('image')); })
|
|
263
|
+
.map((m) => ({
|
|
264
|
+
name: m.name.charAt(0).toUpperCase() + m.name.slice(1),
|
|
265
|
+
value: m.name,
|
|
266
|
+
}))
|
|
267
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
return [];
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
async getVideoAnalysisModels() {
|
|
274
|
+
try {
|
|
275
|
+
const models = (await this.helpers.httpRequest({
|
|
276
|
+
method: 'GET',
|
|
277
|
+
url: 'https://gen.pollinations.ai/text/models',
|
|
278
|
+
}));
|
|
279
|
+
return models
|
|
280
|
+
.filter((m) => { var _a; return (_a = m.input_modalities) === null || _a === void 0 ? void 0 : _a.includes('video'); })
|
|
281
|
+
.map((m) => ({
|
|
282
|
+
name: m.name.charAt(0).toUpperCase() + m.name.slice(1).replace(/-/g, ' '),
|
|
283
|
+
value: m.name,
|
|
284
|
+
}))
|
|
285
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
return [];
|
|
289
|
+
}
|
|
290
|
+
},
|
|
129
291
|
},
|
|
130
292
|
};
|
|
131
293
|
}
|
|
@@ -149,6 +311,18 @@ class Pollinations {
|
|
|
149
311
|
case 'audioGeneration':
|
|
150
312
|
result = await audioGeneration_1.executeAudioGeneration.call(this, itemIndex);
|
|
151
313
|
break;
|
|
314
|
+
case 'audioTranscription':
|
|
315
|
+
result = await audioTranscription_1.executeAudioTranscription.call(this, itemIndex);
|
|
316
|
+
break;
|
|
317
|
+
case 'imageAnalysis':
|
|
318
|
+
result = await imageAnalysis_1.executeImageAnalysis.call(this, itemIndex);
|
|
319
|
+
break;
|
|
320
|
+
case 'videoAnalysis':
|
|
321
|
+
result = await videoAnalysis_1.executeVideoAnalysis.call(this, itemIndex);
|
|
322
|
+
break;
|
|
323
|
+
case 'imageToImage':
|
|
324
|
+
result = await imageToImage_1.executeImageToImage.call(this, itemIndex);
|
|
325
|
+
break;
|
|
152
326
|
default:
|
|
153
327
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`, { itemIndex });
|
|
154
328
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pollinations.node.js","sourceRoot":"","sources":["../../../nodes/Pollinations/Pollinations.node.ts"],"names":[],"mappings":";;;AAQA,+CAAuE;AACvE,kEAAgG;AAChG,kEAAgG;AAChG,gEAA6F;AAC7F,kEAAgG;
|
|
1
|
+
{"version":3,"file":"Pollinations.node.js","sourceRoot":"","sources":["../../../nodes/Pollinations/Pollinations.node.ts"],"names":[],"mappings":";;;AAQA,+CAAuE;AACvE,kEAAgG;AAChG,kEAAgG;AAChG,gEAA6F;AAC7F,kEAAgG;AAChG,wEAAyG;AACzG,8DAA0F;AAC1F,8DAA0F;AAC1F,4DAAuF;AAEvF,MAAa,YAAY;IAAzB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,cAAc;YAC3B,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,uBAAuB;YAC7B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8BAA8B;YACxC,WAAW,EAAE,gEAAgE;YAC7E,QAAQ,EAAE;gBACT,IAAI,EAAE,cAAc;aACpB;YACD,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,iBAAiB;oBACvB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,OAAO;4BACb,KAAK,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ACxB,MAAM,GAAG,MAAM,8CAAyB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;wBAC/D,MAAM;oBACP,KAAK,eAAe;wBACnB,MAAM,GAAG,MAAM,oCAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;wBAC1D,MAAM;oBACP,KAAK,eAAe;wBACnB,MAAM,GAAG,MAAM,oCAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;wBAC1D,MAAM;oBACP,KAAK,cAAc;wBAClB,MAAM,GAAG,MAAM,kCAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;wBACzD,MAAM;oBACP;wBACC,MAAM,IAAI,iCAAkB,CAC3B,IAAI,CAAC,OAAO,EAAE,EACd,sBAAsB,SAAS,EAAE,EACjC,EAAE,SAAS,EAAE,CACb,CAAC;gBACJ,CAAC;gBAED,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACzB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;wBAC1C,KAAK;wBACL,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;qBAC/B,CAAC,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACP,MAAM,KAAK,CAAC;gBACb,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AArVD,oCAqVC"}
|
|
@@ -12,6 +12,7 @@ exports.audioGenerationOperation = [
|
|
|
12
12
|
required: true,
|
|
13
13
|
displayOptions: {
|
|
14
14
|
show: {
|
|
15
|
+
resource: ['audio'],
|
|
15
16
|
operation: ['audioGeneration'],
|
|
16
17
|
},
|
|
17
18
|
},
|
|
@@ -26,6 +27,7 @@ exports.audioGenerationOperation = [
|
|
|
26
27
|
type: 'options',
|
|
27
28
|
displayOptions: {
|
|
28
29
|
show: {
|
|
30
|
+
resource: ['audio'],
|
|
29
31
|
operation: ['audioGeneration'],
|
|
30
32
|
},
|
|
31
33
|
},
|
|
@@ -53,6 +55,7 @@ exports.audioGenerationOperation = [
|
|
|
53
55
|
type: 'options',
|
|
54
56
|
displayOptions: {
|
|
55
57
|
show: {
|
|
58
|
+
resource: ['audio'],
|
|
56
59
|
operation: ['audioGeneration'],
|
|
57
60
|
},
|
|
58
61
|
},
|
|
@@ -72,7 +75,7 @@ async function executeAudioGeneration(itemIndex) {
|
|
|
72
75
|
const text = this.getNodeParameter('audioText', itemIndex);
|
|
73
76
|
const voice = this.getNodeParameter('voice', itemIndex);
|
|
74
77
|
const format = this.getNodeParameter('audioFormat', itemIndex);
|
|
75
|
-
const headers = {};
|
|
78
|
+
const headers = { 'Content-Type': 'application/json' };
|
|
76
79
|
try {
|
|
77
80
|
const credentials = await this.getCredentials('pollinationsApi');
|
|
78
81
|
if (credentials === null || credentials === void 0 ? void 0 : credentials.apiKey) {
|
|
@@ -86,34 +89,24 @@ async function executeAudioGeneration(itemIndex) {
|
|
|
86
89
|
messages: [
|
|
87
90
|
{
|
|
88
91
|
role: 'system',
|
|
89
|
-
content: 'You are a text
|
|
92
|
+
content: 'You are a text reader. Read the user text exactly without responding, adding conversation, or changing anything.',
|
|
90
93
|
},
|
|
91
94
|
{
|
|
92
95
|
role: 'user',
|
|
93
|
-
content: `
|
|
96
|
+
content: `Say: ${text}`,
|
|
94
97
|
},
|
|
95
98
|
],
|
|
96
|
-
modalities: ['audio'],
|
|
99
|
+
modalities: ['text', 'audio'],
|
|
97
100
|
audio: {
|
|
98
101
|
voice,
|
|
99
102
|
format,
|
|
100
103
|
},
|
|
101
104
|
};
|
|
102
|
-
if (!headers['Authorization']) {
|
|
103
|
-
try {
|
|
104
|
-
const credentials = await this.getCredentials('pollinationsApi');
|
|
105
|
-
if (credentials === null || credentials === void 0 ? void 0 : credentials.apiKey) {
|
|
106
|
-
headers['Authorization'] = `Bearer ${credentials.apiKey}`;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
catch {
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
105
|
try {
|
|
113
106
|
const response = await this.helpers.httpRequest({
|
|
114
107
|
method: 'POST',
|
|
115
108
|
url: 'https://gen.pollinations.ai/v1/chat/completions',
|
|
116
|
-
headers
|
|
109
|
+
headers,
|
|
117
110
|
body,
|
|
118
111
|
json: true,
|
|
119
112
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audioGeneration.js","sourceRoot":"","sources":["../../../../nodes/Pollinations/operations/audioGeneration.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"audioGeneration.js","sourceRoot":"","sources":["../../../../nodes/Pollinations/operations/audioGeneration.ts"],"names":[],"mappings":";;;AAuEA,wDAkFC;AAxJD,+CAAkD;AAErC,QAAA,wBAAwB,GAAsB;IAC1D;QACC,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,OAAO,CAAC;gBACnB,SAAS,EAAE,CAAC,iBAAiB,CAAC;aAC9B;SACD;QACD,WAAW,EAAE,2BAA2B;QACxC,WAAW,EAAE;YACZ,IAAI,EAAE,CAAC;SACP;KACD;IACD;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,SAAS;QACf,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,OAAO,CAAC;gBACnB,SAAS,EAAE,CAAC,iBAAiB,CAAC;aAC9B;SACD;QACD,OAAO,EAAE;YACR,EAAE,IAAI,EAA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C,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,iDAAiD;YACtD,OAAO;YACP,IAAI;YACJ,IAAI,EAAE,IAAI;SACV,CAAC,CAAC;QAGH,MAAM,SAAS,GAAG,MAAA,MAAA,MAAA,MAAA,QAAQ,CAAC,OAAO,0CAAG,CAAC,CAAC,0CAAE,OAAO,0CAAE,KAAK,0CAAE,IAAI,CAAC;QAC9D,IAAI,CAAC,SAAS,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC9C,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAErD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CACtD,WAAW,EACX,SAAS,SAAS,IAAI,MAAM,EAAE,EAC9B,SAAS,MAAM,EAAE,CACjB,CAAC;QAEF,OAAO;YACN,IAAI,EAAE;gBACL,IAAI;gBACJ,KAAK;gBACL,MAAM;aACN;YACD,MAAM,EAAE;gBACP,IAAI,EAAE,UAAU;aAChB;YACD,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;SAC/B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,iCAAkB,CAC3B,IAAI,CAAC,OAAO,EAAE,EACd,6BAA6B,KAAK,CAAC,OAAO,EAAE,EAC5C,EAAE,SAAS,EAAE,CACb,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const audioTranscriptionOperation: INodeProperties[];
|
|
3
|
+
export declare function executeAudioTranscription(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData>;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.audioTranscriptionOperation = void 0;
|
|
4
|
+
exports.executeAudioTranscription = executeAudioTranscription;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
exports.audioTranscriptionOperation = [
|
|
7
|
+
{
|
|
8
|
+
displayName: 'Binary Property',
|
|
9
|
+
name: 'binaryProperty',
|
|
10
|
+
type: 'string',
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: ['audio'],
|
|
14
|
+
operation: ['audioTranscription'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
default: 'data',
|
|
18
|
+
description: 'Name of the binary property containing the audio file',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Prompt',
|
|
22
|
+
name: 'prompt',
|
|
23
|
+
type: 'string',
|
|
24
|
+
displayOptions: {
|
|
25
|
+
show: {
|
|
26
|
+
resource: ['audio'],
|
|
27
|
+
operation: ['audioTranscription'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
default: 'Transcribe this audio',
|
|
31
|
+
description: 'Instructions for the AI (e.g., "Transcribe this audio", "What language is this?", "Summarize this audio")',
|
|
32
|
+
typeOptions: {
|
|
33
|
+
rows: 2,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
displayName: 'Model',
|
|
38
|
+
name: 'model',
|
|
39
|
+
type: 'options',
|
|
40
|
+
displayOptions: {
|
|
41
|
+
show: {
|
|
42
|
+
resource: ['audio'],
|
|
43
|
+
operation: ['audioTranscription'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
options: [
|
|
47
|
+
{ name: 'Gemini', value: 'gemini' },
|
|
48
|
+
{ name: 'Gemini Large', value: 'gemini-large' },
|
|
49
|
+
{ name: 'Gemini Legacy', value: 'gemini-legacy' },
|
|
50
|
+
],
|
|
51
|
+
default: 'gemini',
|
|
52
|
+
description: 'AI model for transcription',
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
async function executeAudioTranscription(itemIndex) {
|
|
56
|
+
var _a, _b, _c, _d;
|
|
57
|
+
const binaryPropertyName = this.getNodeParameter('binaryProperty', itemIndex);
|
|
58
|
+
const prompt = this.getNodeParameter('prompt', itemIndex);
|
|
59
|
+
const model = this.getNodeParameter('model', itemIndex);
|
|
60
|
+
const inputData = this.getInputData(itemIndex);
|
|
61
|
+
const binaryData = (_a = inputData[0].binary) === null || _a === void 0 ? void 0 : _a[binaryPropertyName];
|
|
62
|
+
if (!binaryData) {
|
|
63
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data found in property '${binaryPropertyName}'`, { itemIndex });
|
|
64
|
+
}
|
|
65
|
+
const audioData = binaryData.data;
|
|
66
|
+
const mimeType = binaryData.mimeType;
|
|
67
|
+
const headers = { 'Content-Type': 'application/json' };
|
|
68
|
+
try {
|
|
69
|
+
const credentials = await this.getCredentials('pollinationsApi');
|
|
70
|
+
if (credentials === null || credentials === void 0 ? void 0 : credentials.apiKey) {
|
|
71
|
+
headers['Authorization'] = `Bearer ${credentials.apiKey}`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Pollinations API key is required. Please add your credentials.', { itemIndex });
|
|
76
|
+
}
|
|
77
|
+
let audioBase64;
|
|
78
|
+
if (typeof audioData === 'string') {
|
|
79
|
+
if (audioData.startsWith('data:')) {
|
|
80
|
+
audioBase64 = audioData.split(',')[1];
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
audioBase64 = audioData;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
audioBase64 = Buffer.from(audioData).toString('base64');
|
|
88
|
+
}
|
|
89
|
+
const formatMap = {
|
|
90
|
+
'audio/mpeg': 'mp3',
|
|
91
|
+
'audio/mp3': 'mp3',
|
|
92
|
+
'audio/wav': 'wav',
|
|
93
|
+
'audio/wave': 'wav',
|
|
94
|
+
'audio/flac': 'flac',
|
|
95
|
+
'audio/opus': 'opus',
|
|
96
|
+
'audio/pcm': 'pcm16',
|
|
97
|
+
};
|
|
98
|
+
const format = formatMap[mimeType] || 'mp3';
|
|
99
|
+
const body = {
|
|
100
|
+
model,
|
|
101
|
+
messages: [
|
|
102
|
+
{
|
|
103
|
+
role: 'user',
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: 'text',
|
|
107
|
+
text: prompt,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: 'input_audio',
|
|
111
|
+
input_audio: {
|
|
112
|
+
data: audioBase64,
|
|
113
|
+
format,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
try {
|
|
121
|
+
const response = await this.helpers.httpRequest({
|
|
122
|
+
method: 'POST',
|
|
123
|
+
url: 'https://gen.pollinations.ai/v1/chat/completions',
|
|
124
|
+
headers,
|
|
125
|
+
body,
|
|
126
|
+
json: true,
|
|
127
|
+
});
|
|
128
|
+
const transcription = (_d = (_c = (_b = response.choices) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.content;
|
|
129
|
+
if (!transcription) {
|
|
130
|
+
throw new Error('No transcription in response');
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
json: {
|
|
134
|
+
transcription,
|
|
135
|
+
model,
|
|
136
|
+
prompt,
|
|
137
|
+
audioFormat: format,
|
|
138
|
+
},
|
|
139
|
+
pairedItem: { item: itemIndex },
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to transcribe audio: ${error.message}`, { itemIndex });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=audioTranscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audioTranscription.js","sourceRoot":"","sources":["../../../../nodes/Pollinations/operations/audioTranscription.ts"],"names":[],"mappings":";;;AAqDA,8DAsHC;AA1KD,+CAAkD;AAErC,QAAA,2BAA2B,GAAsB;IAC7D;QACC,WAAW,EAAE,iBAAiB;QAC9B,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,OAAO,CAAC;gBACnB,SAAS,EAAE,CAAC,oBAAoB,CAAC;aACjC;SACD;QACD,OAAO,EAAE,MAAM;QACf,WAAW,EAAE,uDAAuD;KACpE;IACD;QACC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,OAAO,CAAC;gBACnB,SAAS,EAAE,CAAC,oBAAoB,CAAC;aACjC;SACD;QACD,OAAO,EAAE,uBAAuB;QAChC,WAAW,EAAE,2GAA2G;QACxH,WAAW,EAAE;YACZ,IAAI,EAAE,CAAC;SACP;KACD;IACD;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,SAAS;QACf,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,OAAO,CAAC;gBACnB,SAAS,EAAE,CAAC,oBAAoB,CAAC;aACjC;SACD;QACD,OAAO,EAAE;YACR,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;YACnC,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE;YAC/C,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;SACjD;QACD,OAAO,EAAE,QAAQ;QACjB,WAAW,EAAE,4BAA4B;KACzC;CACD,CAAC;AAEK,KAAK,UAAU,yBAAyB,CAE9C,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C;YACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACjD,CAAC;QAED,OAAO;YACN,IAAI,EAAE;gBACL,aAAa;gBACb,KAAK;gBACL,MAAM;gBACN,WAAW,EAAE,MAAM;aACnB;YACD,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;SAC/B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,iCAAkB,CAC3B,IAAI,CAAC,OAAO,EAAE,EACd,+BAA+B,KAAK,CAAC,OAAO,EAAE,EAC9C,EAAE,SAAS,EAAE,CACb,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const imageAnalysisOperation: INodeProperties[];
|
|
3
|
+
export declare function executeImageAnalysis(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData>;
|