n8n-nodes-pollinations-v2 1.2.29 → 1.2.31
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 +4 -0
- package/dist/nodes/Pollinations/Pollinations.node.js +201 -9
- package/dist/nodes/Pollinations/Pollinations.node.js.map +1 -1
- package/dist/nodes/Pollinations/operations/audioGeneration.js +12 -1
- 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 +160 -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 +130 -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 +158 -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 +131 -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,10 @@ 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[]>;
|
|
12
|
+
getTranscriptionModels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
9
13
|
};
|
|
10
14
|
};
|
|
11
15
|
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
|
+
},
|
|
32
65
|
{
|
|
33
66
|
displayName: 'Operation',
|
|
34
67
|
name: 'operation',
|
|
35
68
|
type: 'options',
|
|
36
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
|
+
},
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Operation',
|
|
93
|
+
name: 'operation',
|
|
94
|
+
type: 'options',
|
|
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',
|
|
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'],
|
|
49
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,78 @@ 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
|
+
},
|
|
291
|
+
async getTranscriptionModels() {
|
|
292
|
+
try {
|
|
293
|
+
const models = (await this.helpers.httpRequest({
|
|
294
|
+
method: 'GET',
|
|
295
|
+
url: 'https://gen.pollinations.ai/text/models',
|
|
296
|
+
}));
|
|
297
|
+
return models
|
|
298
|
+
.filter((m) => { var _a; return (_a = m.input_modalities) === null || _a === void 0 ? void 0 : _a.includes('audio'); })
|
|
299
|
+
.map((m) => ({
|
|
300
|
+
name: m.name.charAt(0).toUpperCase() + m.name.slice(1).replace(/-/g, ' '),
|
|
301
|
+
value: m.name,
|
|
302
|
+
}))
|
|
303
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
304
|
+
}
|
|
305
|
+
catch {
|
|
306
|
+
return [];
|
|
307
|
+
}
|
|
308
|
+
},
|
|
129
309
|
},
|
|
130
310
|
};
|
|
131
311
|
}
|
|
@@ -149,6 +329,18 @@ class Pollinations {
|
|
|
149
329
|
case 'audioGeneration':
|
|
150
330
|
result = await audioGeneration_1.executeAudioGeneration.call(this, itemIndex);
|
|
151
331
|
break;
|
|
332
|
+
case 'audioTranscription':
|
|
333
|
+
result = await audioTranscription_1.executeAudioTranscription.call(this, itemIndex);
|
|
334
|
+
break;
|
|
335
|
+
case 'imageAnalysis':
|
|
336
|
+
result = await imageAnalysis_1.executeImageAnalysis.call(this, itemIndex);
|
|
337
|
+
break;
|
|
338
|
+
case 'videoAnalysis':
|
|
339
|
+
result = await videoAnalysis_1.executeVideoAnalysis.call(this, itemIndex);
|
|
340
|
+
break;
|
|
341
|
+
case 'imageToImage':
|
|
342
|
+
result = await imageToImage_1.executeImageToImage.call(this, itemIndex);
|
|
343
|
+
break;
|
|
152
344
|
default:
|
|
153
345
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`, { itemIndex });
|
|
154
346
|
}
|
|
@@ -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,E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AuWC"}
|
|
@@ -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
|
},
|
|
@@ -112,7 +115,15 @@ async function executeAudioGeneration(itemIndex) {
|
|
|
112
115
|
throw new Error('No audio data in response');
|
|
113
116
|
}
|
|
114
117
|
const audioBuffer = Buffer.from(audioData, 'base64');
|
|
115
|
-
const
|
|
118
|
+
const mimeTypeMap = {
|
|
119
|
+
mp3: 'audio/mpeg',
|
|
120
|
+
wav: 'audio/wav',
|
|
121
|
+
flac: 'audio/flac',
|
|
122
|
+
opus: 'audio/opus',
|
|
123
|
+
pcm16: 'audio/l16',
|
|
124
|
+
};
|
|
125
|
+
const mimeType = mimeTypeMap[format] || `audio/${format}`;
|
|
126
|
+
const binaryData = await this.helpers.prepareBinaryData(audioBuffer, `audio_${itemIndex}.${format}`, mimeType);
|
|
116
127
|
return {
|
|
117
128
|
json: {
|
|
118
129
|
text,
|
|
@@ -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":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,WAAW;SAClB,CAAC;QACF,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC;QAE1D,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CACtD,WAAW,EACX,SAAS,SAAS,IAAI,MAAM,EAAE,EAC9B,QAAQ,CACR,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,160 @@
|
|
|
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 Name or ID',
|
|
38
|
+
name: 'model',
|
|
39
|
+
type: 'options',
|
|
40
|
+
displayOptions: {
|
|
41
|
+
show: {
|
|
42
|
+
resource: ['audio'],
|
|
43
|
+
operation: ['audioTranscription'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
typeOptions: {
|
|
47
|
+
loadOptionsMethod: 'getTranscriptionModels',
|
|
48
|
+
},
|
|
49
|
+
default: '',
|
|
50
|
+
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
async function executeAudioTranscription(itemIndex) {
|
|
54
|
+
var _a, _b, _c, _d;
|
|
55
|
+
const binaryPropertyName = this.getNodeParameter('binaryProperty', itemIndex);
|
|
56
|
+
const prompt = this.getNodeParameter('prompt', itemIndex);
|
|
57
|
+
const model = this.getNodeParameter('model', itemIndex);
|
|
58
|
+
const inputData = this.getInputData();
|
|
59
|
+
const binaryData = (_a = inputData[itemIndex].binary) === null || _a === void 0 ? void 0 : _a[binaryPropertyName];
|
|
60
|
+
if (!binaryData) {
|
|
61
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data found in property '${binaryPropertyName}'`, { itemIndex });
|
|
62
|
+
}
|
|
63
|
+
const audioData = binaryData.data;
|
|
64
|
+
const mimeType = binaryData.mimeType;
|
|
65
|
+
const headers = { 'Content-Type': 'application/json' };
|
|
66
|
+
try {
|
|
67
|
+
const credentials = await this.getCredentials('pollinationsApi');
|
|
68
|
+
if (credentials === null || credentials === void 0 ? void 0 : credentials.apiKey) {
|
|
69
|
+
headers['Authorization'] = `Bearer ${credentials.apiKey}`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Pollinations API key is required. Please add your credentials.', { itemIndex });
|
|
74
|
+
}
|
|
75
|
+
let audioBase64;
|
|
76
|
+
if (typeof audioData === 'string') {
|
|
77
|
+
if (audioData.startsWith('data:')) {
|
|
78
|
+
audioBase64 = audioData.split(',')[1];
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
audioBase64 = audioData;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
audioBase64 = Buffer.from(audioData).toString('base64');
|
|
86
|
+
}
|
|
87
|
+
const formatMap = {
|
|
88
|
+
'audio/mpeg': 'mp3',
|
|
89
|
+
'audio/mp3': 'mp3',
|
|
90
|
+
'audio/wav': 'wav',
|
|
91
|
+
'audio/wave': 'wav',
|
|
92
|
+
'audio/flac': 'flac',
|
|
93
|
+
'audio/opus': 'opus',
|
|
94
|
+
'audio/pcm': 'pcm16',
|
|
95
|
+
};
|
|
96
|
+
const format = formatMap[mimeType] || 'mp3';
|
|
97
|
+
const body = {
|
|
98
|
+
model,
|
|
99
|
+
messages: [
|
|
100
|
+
{
|
|
101
|
+
role: 'system',
|
|
102
|
+
content: 'You are a transcriber. Return ONLY the exact text spoken in the audio, without any introduction, commentary, or formatting. Do not include phrases like "Here is the transcription" or quotes around the text.',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
role: 'user',
|
|
106
|
+
content: [
|
|
107
|
+
{
|
|
108
|
+
type: 'text',
|
|
109
|
+
text: prompt || 'Transcribe this audio exactly as spoken.',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
type: 'input_audio',
|
|
113
|
+
input_audio: {
|
|
114
|
+
data: audioBase64,
|
|
115
|
+
format,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
};
|
|
122
|
+
try {
|
|
123
|
+
const response = await this.helpers.httpRequest({
|
|
124
|
+
method: 'POST',
|
|
125
|
+
url: 'https://gen.pollinations.ai/v1/chat/completions',
|
|
126
|
+
headers,
|
|
127
|
+
body,
|
|
128
|
+
json: true,
|
|
129
|
+
});
|
|
130
|
+
let 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;
|
|
131
|
+
if (!transcription) {
|
|
132
|
+
throw new Error('No transcription in response');
|
|
133
|
+
}
|
|
134
|
+
const prefixesToRemove = [
|
|
135
|
+
/^Here is the transcription[^:]*:\s*/i,
|
|
136
|
+
/^The transcription is:\s*/i,
|
|
137
|
+
/^Transcription:\s*/i,
|
|
138
|
+
/^Audio transcription:\s*/i,
|
|
139
|
+
/^Text:\s*/i,
|
|
140
|
+
/^["'']|["'']$/g,
|
|
141
|
+
];
|
|
142
|
+
for (const prefix of prefixesToRemove) {
|
|
143
|
+
transcription = transcription.replace(prefix, '');
|
|
144
|
+
}
|
|
145
|
+
transcription = transcription.trim();
|
|
146
|
+
return {
|
|
147
|
+
json: {
|
|
148
|
+
transcription,
|
|
149
|
+
model,
|
|
150
|
+
prompt,
|
|
151
|
+
audioFormat: format,
|
|
152
|
+
},
|
|
153
|
+
pairedItem: { item: itemIndex },
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to transcribe audio: ${error.message}`, { itemIndex });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=audioTranscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audioTranscription.js","sourceRoot":"","sources":["../../../../nodes/Pollinations/operations/audioTranscription.ts"],"names":[],"mappings":";;;AAmDA,8DA0IC;AA5LD,+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,kBAAkB;QAC/B,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,WAAW,EAAE;YACZ,iBAAiB,EAAE,wBAAwB;SAC3C;QACD,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,gHAAgH;KAC7H;CACD,CAAC;AAEK,KAAK,UAAU,yBAAyB,CAE9C,SAAiB;;IAEjB,MAAM,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,CAAC;QAC5D,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACjD,CAAC;QAGD,MAAM,gBAAgB,GAAG;YACxB,sCAAsC;YACtC,4BAA4B;YAC5B,qBAAqB;YACrB,2BAA2B;YAC3B,YAAY;YACZ,gBAAgB;SAChB,CAAC;QAEF,KAAK,MAAM,MAAM,IAAI,gBAAgB,EAAE,CAAC;YACvC,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnD,CAAC;QAED,aAAa,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;QAErC,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>;
|