n8n-nodes-paaalleeee 0.1.7 → 1.1.0
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/LICENSE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2026 n8n
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# n8n-nodes-palatine-speech
|
|
4
4
|
|
|
5
|
-
> Designed for seamless integration of
|
|
5
|
+
> Designed for seamless integration of **Palatine Speech API** into n8n workflows.
|
|
6
6
|
|
|
7
7
|
This is an n8n community node that integrates [Palatine Speech](https://speech.palatine.ru/) into your workflows and enables audio processing tasks such as transcription, diarization, sentiment analysis, and summarization.
|
|
8
8
|
|
|
@@ -15,18 +15,20 @@ This is an n8n community node that integrates [Palatine Speech](https://speech.p
|
|
|
15
15
|
[Use Cases](#use-cases) \
|
|
16
16
|
[Compatibility](#compatibility)\
|
|
17
17
|
[Useful Resources](#useful-resources)\
|
|
18
|
-
[Keywords](#keywords)
|
|
18
|
+
[Keywords](#keywords) \
|
|
19
|
+
[License](#license) \
|
|
20
|
+
[Support](#support)
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
> Looking for a Russian version? [Here](https://gist.github.com/haxbxbdbhshs/b7dfc63659d0417b3d73d0b1d0a3002f)
|
|
21
23
|
|
|
22
24
|
## Supported Operations
|
|
23
25
|
|
|
24
|
-
For details on each operation, see the
|
|
26
|
+
For details on each operation, see the Palatine Speech [documentation](https://docs.speech.palatine.ru/documentation/quick_start/transcription). You can also open the documentation by clicking the operation title below.
|
|
25
27
|
|
|
26
28
|
* [Full list of supported file types](https://docs.speech.palatine.ru/documentation/technical_information/supported_files)
|
|
27
29
|
* [Full list of supported languages](https://docs.speech.palatine.ru/documentation/technical_information/supported_languages)
|
|
28
30
|
|
|
29
|
-
### [Transcribe — speech transcription](https://docs.speech.palatine.ru/
|
|
31
|
+
### [Transcribe — speech transcription](https://docs.speech.palatine.ru/api-reference/transcribe/transcribe-polling-api/transcribe)
|
|
30
32
|
|
|
31
33
|
Speech-to-Text (STT) converts audio/video into a written transcript.
|
|
32
34
|
It supports multiple languages and can automatically detect the language spoken in the recording.
|
|
@@ -36,11 +38,11 @@ It is well-suited for calls, interviews, lectures, and any other recordings wher
|
|
|
36
38
|
|
|
37
39
|
Speaker diarization separates a recording into speaker segments and identifies who is speaking in each segment. This is useful for meetings and interviews, where keeping the conversation structure by speaker matters.
|
|
38
40
|
|
|
39
|
-
### [Sentiment Analysis — sentiment analysis](https://docs.speech.palatine.ru/
|
|
41
|
+
### [Sentiment Analysis — sentiment analysis](https://docs.speech.palatine.ru/api-reference/sentiment-analysis/sentiment-analysis-polling-api/sentiment-analysis)
|
|
40
42
|
|
|
41
43
|
Determines the emotional tone of speech in audio/video (and can also analyze text). The result is a ranked list of sentiment classes with probabilities, where the first item is the most likely: `Very Negative`, `Negative`, `Neutral`, `Positive`, `Very Positive`.
|
|
42
44
|
|
|
43
|
-
### [Summarize — audio summarization](https://docs.speech.palatine.ru/
|
|
45
|
+
### [Summarize — audio summarization](https://docs.speech.palatine.ru/api-reference/ai-service/ai-service/summarize-file)
|
|
44
46
|
|
|
45
47
|
Generates a structured summary from audio/video (or from already available text). In addition to built-in scenarios such as `meeting_summary`, it supports `user_prompt` — you can provide a custom prompt for the LLM to produce output in the structure you need (bullet points, decisions and action items, risks, Q&A, etc.).
|
|
46
48
|
|
|
@@ -73,7 +75,7 @@ Generates a structured summary from audio/video (or from already available text)
|
|
|
73
75
|
|
|
74
76
|
* **Meeting summaries** \
|
|
75
77
|
For meeting and interview recordings, it is recommended to use `Summarize` (`meeting_summary`): it produces a brief summary, a list of decisions, and group action items by owner and due date; the result can be sent to the team chat if needed. \
|
|
76
|
-
For non-standard requests, specify `Prompt` in `Summarize` and provide the required instruction, for example:
|
|
78
|
+
For non-standard requests, specify `Prompt` in `Summarize` and provide the required instruction, for example: "Additionally, structure the agreements by deadlines and owners."
|
|
77
79
|
|
|
78
80
|
* **Lecture/webinar notes** \
|
|
79
81
|
Session recording → `Transcribe` → generate a full transcript. \
|
|
@@ -105,4 +107,4 @@ This node was tested with n8n v1.39.1 and later.
|
|
|
105
107
|
MIT
|
|
106
108
|
|
|
107
109
|
## Support
|
|
108
|
-
Telegram @Speech_Palatine_Support_Bot
|
|
110
|
+
Need help? Contact our Telegram support bot: [@Speech_Palatine_Support_Bot](https://t.me/Speech_Palatine_Support_Bot)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class PalatineSpeechNode implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PalatineSpeechNode = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class PalatineSpeechNode {
|
|
6
|
+
description = {
|
|
7
|
+
displayName: 'Palatine Speech',
|
|
8
|
+
name: 'PalatineSpeechNode',
|
|
9
|
+
icon: {
|
|
10
|
+
light: 'file:logoLight.svg',
|
|
11
|
+
dark: 'file:logoDark.svg',
|
|
12
|
+
},
|
|
13
|
+
group: ['transform'],
|
|
14
|
+
version: 1,
|
|
15
|
+
description: 'Use Palatine Speech API to transcribe audio, diarize speakers, analyze sentiment, generate AI summaries and more',
|
|
16
|
+
defaults: {
|
|
17
|
+
name: 'Palatine Speech',
|
|
18
|
+
},
|
|
19
|
+
inputs: ['main'],
|
|
20
|
+
outputs: ['main'],
|
|
21
|
+
credentials: [{ name: 'PalatineSpeechNodeApi', required: true }],
|
|
22
|
+
properties: [
|
|
23
|
+
{
|
|
24
|
+
displayName: 'File',
|
|
25
|
+
name: 'binaryProperty',
|
|
26
|
+
type: 'string',
|
|
27
|
+
default: 'data',
|
|
28
|
+
description: 'Name of binary property that contains audio file',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Task',
|
|
32
|
+
name: 'task',
|
|
33
|
+
type: 'options',
|
|
34
|
+
options: [
|
|
35
|
+
{ name: 'Transcribe', value: 'transcribe', description: 'Convert speech in audio file to text' },
|
|
36
|
+
{ name: 'Diarize', value: 'diarize', description: 'Split audio by speakers and return timestamps for each segment' },
|
|
37
|
+
{ name: 'Sentiment Analysis', value: 'sentiment', description: 'Detect sentiment/emotion in audio and return scores' },
|
|
38
|
+
{ name: 'Summarize', value: 'summarize', description: 'Generate an AI summary of audio (notes, decisions, action items)' },
|
|
39
|
+
],
|
|
40
|
+
default: 'transcribe',
|
|
41
|
+
description: 'Select what to do with audio file',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: 'Model',
|
|
45
|
+
name: 'model',
|
|
46
|
+
type: 'options',
|
|
47
|
+
options: [
|
|
48
|
+
{ name: 'palatine_small', value: 'palatine_small', description: 'Model used for transcription processing' },
|
|
49
|
+
{ name: 'palatine_large_highspeed', value: 'palatine_large_highspeed', description: 'Model used for transcription processing' },
|
|
50
|
+
],
|
|
51
|
+
displayOptions: {
|
|
52
|
+
show: {
|
|
53
|
+
task: ['transcribe'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
default: 'palatine_small',
|
|
57
|
+
description: 'Model used for transcription processing',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
displayName: 'Polling Interval',
|
|
61
|
+
name: 'pollIntervalMs',
|
|
62
|
+
type: 'number',
|
|
63
|
+
typeOptions: {
|
|
64
|
+
minValue: 500,
|
|
65
|
+
maxValue: 900000,
|
|
66
|
+
},
|
|
67
|
+
default: 1000,
|
|
68
|
+
description: 'How often node polls API to retrieve result. Minimum 500 ms, maximum 900000 ms',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
displayName: 'Max Poll Attempts',
|
|
72
|
+
name: 'maxPollAttempts',
|
|
73
|
+
type: 'number',
|
|
74
|
+
typeOptions: {
|
|
75
|
+
minValue: 1,
|
|
76
|
+
maxValue: 1000,
|
|
77
|
+
},
|
|
78
|
+
default: 300,
|
|
79
|
+
description: 'How many times node polls API before giving up. Minimum 1 attempt, maximum 1000 attempts',
|
|
80
|
+
},
|
|
81
|
+
// Summarize-only
|
|
82
|
+
{
|
|
83
|
+
displayName: 'AI Task',
|
|
84
|
+
name: 'summarizeTask',
|
|
85
|
+
type: 'options',
|
|
86
|
+
options: [
|
|
87
|
+
{ name: 'Meeting Summary', value: 'meeting_summary', description: 'Ready-made meeting summary: key points, decisions, and action items' },
|
|
88
|
+
{ name: 'User Prompt', value: 'user_prompt', description: 'Use your own prompt to control summary format/content' },
|
|
89
|
+
],
|
|
90
|
+
default: 'meeting_summary',
|
|
91
|
+
description: 'Summarization mode',
|
|
92
|
+
displayOptions: { show: { task: ['summarize'] } },
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Prompt',
|
|
96
|
+
name: 'summarizePrompt',
|
|
97
|
+
type: 'string',
|
|
98
|
+
default: '',
|
|
99
|
+
description: 'Your instruction for AI. Used only with "User Prompt". Leave blank to use default prompt',
|
|
100
|
+
displayOptions: {
|
|
101
|
+
show: {
|
|
102
|
+
task: ['summarize'],
|
|
103
|
+
summarizeTask: ['user_prompt'],
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
displayName: 'Thinking',
|
|
109
|
+
name: 'summarizeThinking',
|
|
110
|
+
type: 'boolean',
|
|
111
|
+
default: false,
|
|
112
|
+
description: 'Enable "thinking" mode for deeper reasoning (may increase processing time)',
|
|
113
|
+
displayOptions: { show: { task: ['summarize'] } },
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
async execute() {
|
|
118
|
+
const items = this.getInputData();
|
|
119
|
+
const returnData = [];
|
|
120
|
+
// Polling
|
|
121
|
+
const defaultPollIntervalMsFast = 500;
|
|
122
|
+
const defaultMaxPollAttemptsFast = 200;
|
|
123
|
+
const defaultPollIntervalMsSummarize = 20000;
|
|
124
|
+
const defaultMaxPollAttemptsSummarize = 500;
|
|
125
|
+
const credentials = await this.getCredentials('PalatineSpeechNodeApi');
|
|
126
|
+
const baseUrl = String(credentials.baseUrl || '').replace(/\/$/, '');
|
|
127
|
+
if (!baseUrl) {
|
|
128
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Credential "Base URL" is empty');
|
|
129
|
+
}
|
|
130
|
+
const request = async (options, itemIndex) => {
|
|
131
|
+
try {
|
|
132
|
+
return await this.helpers.httpRequestWithAuthentication.call(this, 'PalatineSpeechNodeApi', options);
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { itemIndex });
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const extractTaskId = (resp) => {
|
|
139
|
+
if (!resp || typeof resp !== 'object')
|
|
140
|
+
return undefined;
|
|
141
|
+
return resp.task_id || resp.taskId || resp.id || resp.task?.id;
|
|
142
|
+
};
|
|
143
|
+
const normalizeStatus = (s) => (typeof s === 'string' ? s.trim().toLowerCase() : '');
|
|
144
|
+
const isTerminalSuccess = (statusPayload) => {
|
|
145
|
+
const s = normalizeStatus(statusPayload?.status) ||
|
|
146
|
+
normalizeStatus(statusPayload?.state) ||
|
|
147
|
+
normalizeStatus(statusPayload?.task_status);
|
|
148
|
+
if (['completed', 'done', 'success', 'finished'].includes(s))
|
|
149
|
+
return true;
|
|
150
|
+
const hasResult = statusPayload?.result !== undefined ||
|
|
151
|
+
statusPayload?.data !== undefined ||
|
|
152
|
+
statusPayload?.output !== undefined ||
|
|
153
|
+
statusPayload?.response !== undefined;
|
|
154
|
+
const looksProcessing = ['queued', 'pending', 'processing', 'running', 'in_progress'].includes(s);
|
|
155
|
+
return hasResult && !looksProcessing;
|
|
156
|
+
};
|
|
157
|
+
const isTerminalFailure = (statusPayload) => {
|
|
158
|
+
const s = normalizeStatus(statusPayload?.status) ||
|
|
159
|
+
normalizeStatus(statusPayload?.state) ||
|
|
160
|
+
normalizeStatus(statusPayload?.task_status);
|
|
161
|
+
return ['failed', 'error', 'canceled', 'cancelled'].includes(s);
|
|
162
|
+
};
|
|
163
|
+
const unwrapFinalPayload = (statusPayload) => statusPayload?.result ??
|
|
164
|
+
statusPayload?.data ??
|
|
165
|
+
statusPayload?.output ??
|
|
166
|
+
statusPayload?.response ??
|
|
167
|
+
statusPayload;
|
|
168
|
+
for (let i = 0; i < items.length; i++) {
|
|
169
|
+
try {
|
|
170
|
+
const binaryProperty = this.getNodeParameter('binaryProperty', i);
|
|
171
|
+
const task = this.getNodeParameter('task', i);
|
|
172
|
+
let model;
|
|
173
|
+
if (task === 'transcribe') {
|
|
174
|
+
model = this.getNodeParameter('model', i);
|
|
175
|
+
}
|
|
176
|
+
const binaryData = items[i].binary?.[binaryProperty];
|
|
177
|
+
if (!binaryData) {
|
|
178
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data in property "${binaryProperty}"`, {
|
|
179
|
+
itemIndex: i,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
let summarizeTask;
|
|
183
|
+
let summarizeThinking = false;
|
|
184
|
+
let summarizePromptRaw = '';
|
|
185
|
+
const taskDefaultPollIntervalMs = task === 'summarize' ? defaultPollIntervalMsSummarize : defaultPollIntervalMsFast;
|
|
186
|
+
const taskDefaultMaxPollAttempts = task === 'summarize' ? defaultMaxPollAttemptsSummarize : defaultMaxPollAttemptsFast;
|
|
187
|
+
let pollIntervalMs = taskDefaultPollIntervalMs;
|
|
188
|
+
let maxPollAttempts = taskDefaultMaxPollAttempts;
|
|
189
|
+
if (task === 'summarize') {
|
|
190
|
+
summarizeTask = this.getNodeParameter('summarizeTask', i);
|
|
191
|
+
summarizeThinking = this.getNodeParameter('summarizeThinking', i);
|
|
192
|
+
if (summarizeTask === 'user_prompt') {
|
|
193
|
+
summarizePromptRaw = this.getNodeParameter('summarizePrompt', i, '') || '';
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
pollIntervalMs = this.getNodeParameter('pollIntervalMs', i, taskDefaultPollIntervalMs);
|
|
197
|
+
pollIntervalMs = Math.min(900000, Math.max(500, pollIntervalMs));
|
|
198
|
+
maxPollAttempts = this.getNodeParameter('maxPollAttempts', i, taskDefaultMaxPollAttempts);
|
|
199
|
+
maxPollAttempts = Math.min(1000, Math.max(1, maxPollAttempts));
|
|
200
|
+
const audioBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
|
|
201
|
+
// Endpoints (polling API)
|
|
202
|
+
let url;
|
|
203
|
+
let qs;
|
|
204
|
+
switch (task) {
|
|
205
|
+
case 'transcribe':
|
|
206
|
+
url = `${baseUrl}/api/v1/transcribe/do_transcribe`;
|
|
207
|
+
break;
|
|
208
|
+
case 'diarize':
|
|
209
|
+
url = `${baseUrl}/api/v1/diarization/do_diarize`;
|
|
210
|
+
break;
|
|
211
|
+
case 'sentiment':
|
|
212
|
+
url = `${baseUrl}/api/v1/sentiment_analysis/analyze_file`;
|
|
213
|
+
break;
|
|
214
|
+
case 'summarize': {
|
|
215
|
+
if (!summarizeTask) {
|
|
216
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Summarize: summarizeTask is missing', {
|
|
217
|
+
itemIndex: i,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
const promptToSend = summarizeTask === 'meeting_summary'
|
|
221
|
+
? '*'
|
|
222
|
+
: (summarizePromptRaw || '').trim() || '*';
|
|
223
|
+
url = `${baseUrl}/api/v1/ai_service/summarize_file`;
|
|
224
|
+
qs = {
|
|
225
|
+
task: summarizeTask,
|
|
226
|
+
prompt: promptToSend,
|
|
227
|
+
thinking: summarizeThinking,
|
|
228
|
+
};
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
default:
|
|
232
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown task: ${task}`, { itemIndex: i });
|
|
233
|
+
}
|
|
234
|
+
// Multipart via built-in FormData/Blob (Node 18+)
|
|
235
|
+
const form = new FormData();
|
|
236
|
+
const fileName = binaryData.fileName || 'audio';
|
|
237
|
+
const mimeType = binaryData.mimeType || 'audio/mpeg';
|
|
238
|
+
const u8 = new Uint8Array(audioBuffer);
|
|
239
|
+
form.append('file', new Blob([u8], { type: mimeType }), fileName);
|
|
240
|
+
if (model) {
|
|
241
|
+
form.append('model', model);
|
|
242
|
+
}
|
|
243
|
+
const createOptions = {
|
|
244
|
+
method: 'POST',
|
|
245
|
+
url,
|
|
246
|
+
qs,
|
|
247
|
+
body: form,
|
|
248
|
+
json: true,
|
|
249
|
+
};
|
|
250
|
+
const createResp = await request(createOptions, i);
|
|
251
|
+
let finalResponse = createResp;
|
|
252
|
+
const taskId = extractTaskId(createResp);
|
|
253
|
+
// If API responded with task_id → poll unified status endpoint
|
|
254
|
+
if (taskId) {
|
|
255
|
+
const statusUrl = `${baseUrl}/api/v1/transcribe/task_status/${taskId}`;
|
|
256
|
+
let statusPayload = null;
|
|
257
|
+
let completed = false;
|
|
258
|
+
for (let attempt = 1; attempt <= maxPollAttempts; attempt++) {
|
|
259
|
+
statusPayload = await request({
|
|
260
|
+
method: 'GET',
|
|
261
|
+
url: statusUrl,
|
|
262
|
+
json: true,
|
|
263
|
+
}, i);
|
|
264
|
+
if (isTerminalFailure(statusPayload)) {
|
|
265
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Task ${taskId} failed: ${statusPayload?.error || statusPayload?.message || JSON.stringify(statusPayload)}`, { itemIndex: i });
|
|
266
|
+
}
|
|
267
|
+
if (isTerminalSuccess(statusPayload)) {
|
|
268
|
+
finalResponse = unwrapFinalPayload(statusPayload);
|
|
269
|
+
completed = true;
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
await (0, n8n_workflow_1.sleep)(pollIntervalMs);
|
|
273
|
+
}
|
|
274
|
+
if (!completed) {
|
|
275
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Task ${taskId} did not complete within polling limit (${maxPollAttempts} attempts)`, { itemIndex: i });
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
// Output
|
|
279
|
+
const result = {
|
|
280
|
+
task,
|
|
281
|
+
source_file: binaryData.fileName,
|
|
282
|
+
};
|
|
283
|
+
if (task === 'transcribe' && model) {
|
|
284
|
+
result.model_used = model;
|
|
285
|
+
}
|
|
286
|
+
if (task === 'transcribe') {
|
|
287
|
+
result.transcription =
|
|
288
|
+
typeof finalResponse === 'string'
|
|
289
|
+
? finalResponse.trim()
|
|
290
|
+
: finalResponse?.text || finalResponse?.transcription || finalResponse?.data?.text || '';
|
|
291
|
+
}
|
|
292
|
+
else if (task === 'diarize') {
|
|
293
|
+
result.diarization = finalResponse;
|
|
294
|
+
}
|
|
295
|
+
else if (task === 'sentiment') {
|
|
296
|
+
result.sentiment = finalResponse;
|
|
297
|
+
}
|
|
298
|
+
else if (task === 'summarize') {
|
|
299
|
+
result.summary =
|
|
300
|
+
typeof finalResponse === 'string'
|
|
301
|
+
? finalResponse
|
|
302
|
+
: finalResponse?.summary || finalResponse?.result || finalResponse?.text || finalResponse;
|
|
303
|
+
}
|
|
304
|
+
returnData.push({
|
|
305
|
+
json: result,
|
|
306
|
+
binary: items[i].binary,
|
|
307
|
+
pairedItem: { item: i },
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
catch (error) {
|
|
311
|
+
if (this.continueOnFail()) {
|
|
312
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
313
|
+
returnData.push({
|
|
314
|
+
json: { error: message },
|
|
315
|
+
pairedItem: { item: i },
|
|
316
|
+
});
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
// If it's already a NodeOperationError/NodeApiError — rethrow
|
|
320
|
+
throw error;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return [returnData];
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
exports.PalatineSpeechNode = PalatineSpeechNode;
|
|
@@ -12,7 +12,7 @@ class PalatineSpeechNode {
|
|
|
12
12
|
},
|
|
13
13
|
group: ['transform'],
|
|
14
14
|
version: 1,
|
|
15
|
-
description: 'Use Palatine Speech API to transcribe audio, diarize speakers, analyze sentiment, generate AI summaries and more
|
|
15
|
+
description: 'Use Palatine Speech API to transcribe audio, diarize speakers, analyze sentiment, generate AI summaries and more',
|
|
16
16
|
defaults: {
|
|
17
17
|
name: 'Palatine Speech',
|
|
18
18
|
},
|
|
@@ -25,31 +25,58 @@ class PalatineSpeechNode {
|
|
|
25
25
|
name: 'binaryProperty',
|
|
26
26
|
type: 'string',
|
|
27
27
|
default: 'data',
|
|
28
|
-
description: 'Name of
|
|
28
|
+
description: 'Name of binary property that contains audio file',
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
displayName: 'Task',
|
|
32
32
|
name: 'task',
|
|
33
33
|
type: 'options',
|
|
34
34
|
options: [
|
|
35
|
-
{ name: 'Transcribe', value: 'transcribe', description: 'Convert speech in
|
|
36
|
-
{ name: 'Diarize', value: 'diarize', description: 'Split audio by speakers and return timestamps for each segment
|
|
37
|
-
{ name: 'Sentiment Analysis', value: 'sentiment', description: 'Detect sentiment/emotion in
|
|
38
|
-
{ name: 'Summarize', value: 'summarize', description: 'Generate an AI summary of
|
|
35
|
+
{ name: 'Transcribe', value: 'transcribe', description: 'Convert speech in audio file to text' },
|
|
36
|
+
{ name: 'Diarize', value: 'diarize', description: 'Split audio by speakers and return timestamps for each segment' },
|
|
37
|
+
{ name: 'Sentiment Analysis', value: 'sentiment', description: 'Detect sentiment/emotion in audio and return scores' },
|
|
38
|
+
{ name: 'Summarize', value: 'summarize', description: 'Generate an AI summary of audio (notes, decisions, action items)' },
|
|
39
39
|
],
|
|
40
40
|
default: 'transcribe',
|
|
41
|
-
description: 'Select what to do with
|
|
41
|
+
description: 'Select what to do with audio file',
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
displayName: 'Model',
|
|
45
45
|
name: 'model',
|
|
46
46
|
type: 'options',
|
|
47
47
|
options: [
|
|
48
|
-
{ name: 'palatine_small', value: 'palatine_small', description: '
|
|
49
|
-
{ name: 'palatine_large_highspeed', value: 'palatine_large_highspeed', description: '
|
|
48
|
+
{ name: 'palatine_small', value: 'palatine_small', description: 'Model used for transcription processing' },
|
|
49
|
+
{ name: 'palatine_large_highspeed', value: 'palatine_large_highspeed', description: 'Model used for transcription processing' },
|
|
50
50
|
],
|
|
51
|
+
displayOptions: {
|
|
52
|
+
show: {
|
|
53
|
+
task: ['transcribe'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
51
56
|
default: 'palatine_small',
|
|
52
|
-
description: 'Model used for processing
|
|
57
|
+
description: 'Model used for transcription processing',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
displayName: 'Polling Interval',
|
|
61
|
+
name: 'pollIntervalMs',
|
|
62
|
+
type: 'number',
|
|
63
|
+
typeOptions: {
|
|
64
|
+
minValue: 500,
|
|
65
|
+
maxValue: 900000,
|
|
66
|
+
},
|
|
67
|
+
default: 1000,
|
|
68
|
+
description: 'How often node polls API to retrieve result. Minimum 500 ms, maximum 900000 ms',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
displayName: 'Max Poll Attempts',
|
|
72
|
+
name: 'maxPollAttempts',
|
|
73
|
+
type: 'number',
|
|
74
|
+
typeOptions: {
|
|
75
|
+
minValue: 1,
|
|
76
|
+
maxValue: 1000,
|
|
77
|
+
},
|
|
78
|
+
default: 300,
|
|
79
|
+
description: 'How many times node polls API before giving up. Minimum 1 attempt, maximum 1000 attempts',
|
|
53
80
|
},
|
|
54
81
|
// Summarize-only
|
|
55
82
|
{
|
|
@@ -57,11 +84,11 @@ class PalatineSpeechNode {
|
|
|
57
84
|
name: 'summarizeTask',
|
|
58
85
|
type: 'options',
|
|
59
86
|
options: [
|
|
60
|
-
{ name: 'Meeting Summary', value: 'meeting_summary', description: 'Ready-made meeting summary: key points, decisions, and action items
|
|
61
|
-
{ name: 'User Prompt', value: 'user_prompt', description: 'Use your own prompt to control
|
|
87
|
+
{ name: 'Meeting Summary', value: 'meeting_summary', description: 'Ready-made meeting summary: key points, decisions, and action items' },
|
|
88
|
+
{ name: 'User Prompt', value: 'user_prompt', description: 'Use your own prompt to control summary format/content' },
|
|
62
89
|
],
|
|
63
|
-
default: '
|
|
64
|
-
description: 'Summarization mode
|
|
90
|
+
default: 'meeting_summary',
|
|
91
|
+
description: 'Summarization mode',
|
|
65
92
|
displayOptions: { show: { task: ['summarize'] } },
|
|
66
93
|
},
|
|
67
94
|
{
|
|
@@ -69,7 +96,7 @@ class PalatineSpeechNode {
|
|
|
69
96
|
name: 'summarizePrompt',
|
|
70
97
|
type: 'string',
|
|
71
98
|
default: '',
|
|
72
|
-
description: 'Your instruction for
|
|
99
|
+
description: 'Your instruction for AI. Used only with "User Prompt". Leave blank to use default prompt',
|
|
73
100
|
displayOptions: {
|
|
74
101
|
show: {
|
|
75
102
|
task: ['summarize'],
|
|
@@ -82,7 +109,7 @@ class PalatineSpeechNode {
|
|
|
82
109
|
name: 'summarizeThinking',
|
|
83
110
|
type: 'boolean',
|
|
84
111
|
default: false,
|
|
85
|
-
description: 'Enable "thinking" mode for deeper reasoning (may increase processing time)
|
|
112
|
+
description: 'Enable "thinking" mode for deeper reasoning (may increase processing time)',
|
|
86
113
|
displayOptions: { show: { task: ['summarize'] } },
|
|
87
114
|
},
|
|
88
115
|
],
|
|
@@ -91,8 +118,10 @@ class PalatineSpeechNode {
|
|
|
91
118
|
const items = this.getInputData();
|
|
92
119
|
const returnData = [];
|
|
93
120
|
// Polling
|
|
94
|
-
const
|
|
95
|
-
const
|
|
121
|
+
const defaultPollIntervalMsFast = 500;
|
|
122
|
+
const defaultMaxPollAttemptsFast = 200;
|
|
123
|
+
const defaultPollIntervalMsSummarize = 20000;
|
|
124
|
+
const defaultMaxPollAttemptsSummarize = 500;
|
|
96
125
|
const credentials = await this.getCredentials('PalatineSpeechNodeApi');
|
|
97
126
|
const baseUrl = String(credentials.baseUrl || '').replace(/\/$/, '');
|
|
98
127
|
if (!baseUrl) {
|
|
@@ -140,7 +169,10 @@ class PalatineSpeechNode {
|
|
|
140
169
|
try {
|
|
141
170
|
const binaryProperty = this.getNodeParameter('binaryProperty', i);
|
|
142
171
|
const task = this.getNodeParameter('task', i);
|
|
143
|
-
|
|
172
|
+
let model;
|
|
173
|
+
if (task === 'transcribe') {
|
|
174
|
+
model = this.getNodeParameter('model', i);
|
|
175
|
+
}
|
|
144
176
|
const binaryData = items[i].binary?.[binaryProperty];
|
|
145
177
|
if (!binaryData) {
|
|
146
178
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data in property "${binaryProperty}"`, {
|
|
@@ -150,6 +182,10 @@ class PalatineSpeechNode {
|
|
|
150
182
|
let summarizeTask;
|
|
151
183
|
let summarizeThinking = false;
|
|
152
184
|
let summarizePromptRaw = '';
|
|
185
|
+
const taskDefaultPollIntervalMs = task === 'summarize' ? defaultPollIntervalMsSummarize : defaultPollIntervalMsFast;
|
|
186
|
+
const taskDefaultMaxPollAttempts = task === 'summarize' ? defaultMaxPollAttemptsSummarize : defaultMaxPollAttemptsFast;
|
|
187
|
+
let pollIntervalMs = taskDefaultPollIntervalMs;
|
|
188
|
+
let maxPollAttempts = taskDefaultMaxPollAttempts;
|
|
153
189
|
if (task === 'summarize') {
|
|
154
190
|
summarizeTask = this.getNodeParameter('summarizeTask', i);
|
|
155
191
|
summarizeThinking = this.getNodeParameter('summarizeThinking', i);
|
|
@@ -157,6 +193,10 @@ class PalatineSpeechNode {
|
|
|
157
193
|
summarizePromptRaw = this.getNodeParameter('summarizePrompt', i, '') || '';
|
|
158
194
|
}
|
|
159
195
|
}
|
|
196
|
+
pollIntervalMs = this.getNodeParameter('pollIntervalMs', i, taskDefaultPollIntervalMs);
|
|
197
|
+
pollIntervalMs = Math.min(900000, Math.max(500, pollIntervalMs));
|
|
198
|
+
maxPollAttempts = this.getNodeParameter('maxPollAttempts', i, taskDefaultMaxPollAttempts);
|
|
199
|
+
maxPollAttempts = Math.min(1000, Math.max(1, maxPollAttempts));
|
|
160
200
|
const audioBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
|
|
161
201
|
// Endpoints (polling API)
|
|
162
202
|
let url;
|
|
@@ -195,9 +235,11 @@ class PalatineSpeechNode {
|
|
|
195
235
|
const form = new FormData();
|
|
196
236
|
const fileName = binaryData.fileName || 'audio';
|
|
197
237
|
const mimeType = binaryData.mimeType || 'audio/mpeg';
|
|
198
|
-
const u8 = new Uint8Array(audioBuffer);
|
|
238
|
+
const u8 = new Uint8Array(audioBuffer);
|
|
199
239
|
form.append('file', new Blob([u8], { type: mimeType }), fileName);
|
|
200
|
-
|
|
240
|
+
if (model) {
|
|
241
|
+
form.append('model', model);
|
|
242
|
+
}
|
|
201
243
|
const createOptions = {
|
|
202
244
|
method: 'POST',
|
|
203
245
|
url,
|
|
@@ -237,8 +279,10 @@ class PalatineSpeechNode {
|
|
|
237
279
|
const result = {
|
|
238
280
|
task,
|
|
239
281
|
source_file: binaryData.fileName,
|
|
240
|
-
model_used: model,
|
|
241
282
|
};
|
|
283
|
+
if (task === 'transcribe' && model) {
|
|
284
|
+
result.model_used = model;
|
|
285
|
+
}
|
|
242
286
|
if (task === 'transcribe') {
|
|
243
287
|
result.transcription =
|
|
244
288
|
typeof finalResponse === 'string'
|
package/package.json
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-paaalleeee",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Custom n8n node for Palatine Speech API: transcription, diarization, sentiment analysis, summarization and more",
|
|
5
5
|
"keywords": [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n",
|
|
8
|
+
"palatine",
|
|
9
|
+
"speech-to-text",
|
|
10
|
+
"transcribe",
|
|
11
|
+
"transcription",
|
|
12
|
+
"stt",
|
|
13
|
+
"audio",
|
|
14
|
+
"ai",
|
|
15
|
+
"automation",
|
|
16
|
+
"voice-to-text",
|
|
17
|
+
"speech-recognition",
|
|
18
|
+
"audio-transcription",
|
|
19
|
+
"audio2text",
|
|
20
|
+
"audio-processing",
|
|
21
|
+
"diarization",
|
|
22
|
+
"speaker-diarization",
|
|
23
|
+
"speaker-segmentation",
|
|
24
|
+
"summarization",
|
|
25
|
+
"audio-summarization",
|
|
26
|
+
"sentiment-analysis",
|
|
27
|
+
"emotion-detection",
|
|
28
|
+
"tone-analysis"
|
|
29
29
|
],
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"author": "palatine-vision",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"build": "tsc && npm run copy:assets",
|
|
39
39
|
"copy:assets": "node -e \"const fs=require('fs');const path=require('path');const files=['logoLight.svg','logoDark.svg'];const srcDir=path.join('nodes','PalatineSpeechNode');const dstDir=path.join('dist','nodes','PalatineSpeechNode');fs.mkdirSync(dstDir,{recursive:true});let ok=true;for(const f of files){const src=path.join(srcDir,f);const dst=path.join(dstDir,f);if(!fs.existsSync(src)){console.error('ERROR:',f,'not found at',src);ok=false;continue;}fs.copyFileSync(src,dst);console.log('OK: copied',src,'->',dst);}if(!ok) process.exit(1);\"",
|
|
40
40
|
"dev": "tsc --watch",
|
|
41
|
+
|
|
41
42
|
"prepack": "npm run build",
|
|
42
43
|
"prepublishOnly": "npm run build"
|
|
43
44
|
},
|
|
@@ -49,10 +50,11 @@
|
|
|
49
50
|
"dist/nodes/PalatineSpeechNode/PalatineSpeechNode.node.js"
|
|
50
51
|
]
|
|
51
52
|
},
|
|
53
|
+
"dependencies": {},
|
|
52
54
|
"devDependencies": {
|
|
53
55
|
"n8n-core": "^1.80.0",
|
|
54
56
|
"n8n-workflow": "^1.80.0",
|
|
55
|
-
"typescript": "^5.
|
|
57
|
+
"typescript": "^5.5.0"
|
|
56
58
|
},
|
|
57
59
|
"engines": {
|
|
58
60
|
"node": ">=18.0.0"
|