n8n-nodes-paaalleeee 0.1.7 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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;
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PalatineSpeechNode = void 0;
|
|
4
4
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
// Polling defaults (by task)
|
|
6
|
+
const TASK_POLL_DEFAULTS = {
|
|
7
|
+
transcribe: { pollIntervalMs: 500, maxPollAttempts: 200 },
|
|
8
|
+
diarize: { pollIntervalMs: 500, maxPollAttempts: 200 },
|
|
9
|
+
sentiment: { pollIntervalMs: 500, maxPollAttempts: 200 },
|
|
10
|
+
summarize: { pollIntervalMs: 20000, maxPollAttempts: 500 },
|
|
11
|
+
};
|
|
5
12
|
class PalatineSpeechNode {
|
|
6
13
|
description = {
|
|
7
14
|
displayName: 'Palatine Speech',
|
|
@@ -12,7 +19,7 @@ class PalatineSpeechNode {
|
|
|
12
19
|
},
|
|
13
20
|
group: ['transform'],
|
|
14
21
|
version: 1,
|
|
15
|
-
description: 'Use Palatine Speech API to transcribe audio, diarize speakers, analyze sentiment, generate AI summaries and more
|
|
22
|
+
description: 'Use Palatine Speech API to transcribe audio, diarize speakers, analyze sentiment, generate AI summaries and more',
|
|
16
23
|
defaults: {
|
|
17
24
|
name: 'Palatine Speech',
|
|
18
25
|
},
|
|
@@ -25,31 +32,74 @@ class PalatineSpeechNode {
|
|
|
25
32
|
name: 'binaryProperty',
|
|
26
33
|
type: 'string',
|
|
27
34
|
default: 'data',
|
|
28
|
-
description: 'Name of
|
|
35
|
+
description: 'Name of binary property that contains audio file',
|
|
29
36
|
},
|
|
30
37
|
{
|
|
31
38
|
displayName: 'Task',
|
|
32
39
|
name: 'task',
|
|
33
40
|
type: 'options',
|
|
34
41
|
options: [
|
|
35
|
-
{ name: 'Transcribe', value: 'transcribe', description: 'Convert speech in
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
{ name: 'Transcribe', value: 'transcribe', description: 'Convert speech in audio file to text' },
|
|
43
|
+
{
|
|
44
|
+
name: 'Diarize',
|
|
45
|
+
value: 'diarize',
|
|
46
|
+
description: 'Split audio by speakers and return timestamps for each segment',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'Sentiment Analysis',
|
|
50
|
+
value: 'sentiment',
|
|
51
|
+
description: 'Detect sentiment/emotion in audio and return scores',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Summarize',
|
|
55
|
+
value: 'summarize',
|
|
56
|
+
description: 'Generate an AI summary of audio (notes, decisions, action items)',
|
|
57
|
+
},
|
|
39
58
|
],
|
|
40
59
|
default: 'transcribe',
|
|
41
|
-
description: 'Select what to do with
|
|
60
|
+
description: 'Select what to do with audio file',
|
|
42
61
|
},
|
|
43
62
|
{
|
|
44
63
|
displayName: 'Model',
|
|
45
64
|
name: 'model',
|
|
46
65
|
type: 'options',
|
|
47
66
|
options: [
|
|
48
|
-
{ name: 'palatine_small', value: 'palatine_small', description: '
|
|
49
|
-
{
|
|
67
|
+
{ name: 'palatine_small', value: 'palatine_small', description: 'Model used for transcription processing' },
|
|
68
|
+
{
|
|
69
|
+
name: 'palatine_large_highspeed',
|
|
70
|
+
value: 'palatine_large_highspeed',
|
|
71
|
+
description: 'Model used for transcription processing',
|
|
72
|
+
},
|
|
50
73
|
],
|
|
74
|
+
displayOptions: {
|
|
75
|
+
show: {
|
|
76
|
+
task: ['transcribe'],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
51
79
|
default: 'palatine_small',
|
|
52
|
-
description: 'Model used for processing
|
|
80
|
+
description: 'Model used for transcription processing',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
displayName: 'Polling Interval',
|
|
84
|
+
name: 'pollIntervalMs',
|
|
85
|
+
type: 'number',
|
|
86
|
+
typeOptions: {
|
|
87
|
+
minValue: 500,
|
|
88
|
+
maxValue: 900000,
|
|
89
|
+
},
|
|
90
|
+
default: 500,
|
|
91
|
+
description: 'How often node polls API to retrieve result. Minimum 500 ms, maximum 900000 ms. (Summarize: if left unchanged, node uses 20000 ms by default)',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
displayName: 'Max Poll Attempts',
|
|
95
|
+
name: 'maxPollAttempts',
|
|
96
|
+
type: 'number',
|
|
97
|
+
typeOptions: {
|
|
98
|
+
minValue: 1,
|
|
99
|
+
maxValue: 1000,
|
|
100
|
+
},
|
|
101
|
+
default: 200,
|
|
102
|
+
description: 'How many times node polls API before giving up. Minimum 1 attempt, maximum 1000 attempts. (Summarize: if left unchanged, node uses 500 by default)',
|
|
53
103
|
},
|
|
54
104
|
// Summarize-only
|
|
55
105
|
{
|
|
@@ -57,11 +107,19 @@ class PalatineSpeechNode {
|
|
|
57
107
|
name: 'summarizeTask',
|
|
58
108
|
type: 'options',
|
|
59
109
|
options: [
|
|
60
|
-
{
|
|
61
|
-
|
|
110
|
+
{
|
|
111
|
+
name: 'Meeting Summary',
|
|
112
|
+
value: 'meeting_summary',
|
|
113
|
+
description: 'Ready-made meeting summary: key points, decisions, and action items',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'User Prompt',
|
|
117
|
+
value: 'user_prompt',
|
|
118
|
+
description: 'Use your own prompt to control summary format/content',
|
|
119
|
+
},
|
|
62
120
|
],
|
|
63
|
-
default: '
|
|
64
|
-
description: 'Summarization mode
|
|
121
|
+
default: 'meeting_summary',
|
|
122
|
+
description: 'Summarization mode',
|
|
65
123
|
displayOptions: { show: { task: ['summarize'] } },
|
|
66
124
|
},
|
|
67
125
|
{
|
|
@@ -69,7 +127,7 @@ class PalatineSpeechNode {
|
|
|
69
127
|
name: 'summarizePrompt',
|
|
70
128
|
type: 'string',
|
|
71
129
|
default: '',
|
|
72
|
-
description: 'Your instruction for
|
|
130
|
+
description: 'Your instruction for AI. Used only with "User Prompt". Leave blank to use default prompt',
|
|
73
131
|
displayOptions: {
|
|
74
132
|
show: {
|
|
75
133
|
task: ['summarize'],
|
|
@@ -82,7 +140,7 @@ class PalatineSpeechNode {
|
|
|
82
140
|
name: 'summarizeThinking',
|
|
83
141
|
type: 'boolean',
|
|
84
142
|
default: false,
|
|
85
|
-
description: 'Enable "thinking" mode for deeper reasoning (may increase processing time)
|
|
143
|
+
description: 'Enable "thinking" mode for deeper reasoning (may increase processing time)',
|
|
86
144
|
displayOptions: { show: { task: ['summarize'] } },
|
|
87
145
|
},
|
|
88
146
|
],
|
|
@@ -90,9 +148,6 @@ class PalatineSpeechNode {
|
|
|
90
148
|
async execute() {
|
|
91
149
|
const items = this.getInputData();
|
|
92
150
|
const returnData = [];
|
|
93
|
-
// Polling
|
|
94
|
-
const pollIntervalMs = 2000;
|
|
95
|
-
const maxPollAttempts = 150;
|
|
96
151
|
const credentials = await this.getCredentials('PalatineSpeechNodeApi');
|
|
97
152
|
const baseUrl = String(credentials.baseUrl || '').replace(/\/$/, '');
|
|
98
153
|
if (!baseUrl) {
|
|
@@ -140,7 +195,10 @@ class PalatineSpeechNode {
|
|
|
140
195
|
try {
|
|
141
196
|
const binaryProperty = this.getNodeParameter('binaryProperty', i);
|
|
142
197
|
const task = this.getNodeParameter('task', i);
|
|
143
|
-
|
|
198
|
+
let model;
|
|
199
|
+
if (task === 'transcribe') {
|
|
200
|
+
model = this.getNodeParameter('model', i);
|
|
201
|
+
}
|
|
144
202
|
const binaryData = items[i].binary?.[binaryProperty];
|
|
145
203
|
if (!binaryData) {
|
|
146
204
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No binary data in property "${binaryProperty}"`, {
|
|
@@ -157,6 +215,28 @@ class PalatineSpeechNode {
|
|
|
157
215
|
summarizePromptRaw = this.getNodeParameter('summarizePrompt', i, '') || '';
|
|
158
216
|
}
|
|
159
217
|
}
|
|
218
|
+
// Polling params from UI
|
|
219
|
+
let pollIntervalMs = this.getNodeParameter('pollIntervalMs', i);
|
|
220
|
+
let maxPollAttempts = this.getNodeParameter('maxPollAttempts', i);
|
|
221
|
+
// Task-specific defaults (also supports old saved defaults 1000/300)
|
|
222
|
+
const taskDefaults = TASK_POLL_DEFAULTS[task];
|
|
223
|
+
if (task === 'summarize') {
|
|
224
|
+
// if user left UI default (500/200) OR old defaults (1000/300) → use summarize defaults
|
|
225
|
+
if (pollIntervalMs === 500 || pollIntervalMs === 1000)
|
|
226
|
+
pollIntervalMs = taskDefaults.pollIntervalMs; // 20000
|
|
227
|
+
if (maxPollAttempts === 200 || maxPollAttempts === 300)
|
|
228
|
+
maxPollAttempts = taskDefaults.maxPollAttempts; // 500
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
// if old flows have 1000/300 → switch to new non-summarize defaults
|
|
232
|
+
if (pollIntervalMs === 1000)
|
|
233
|
+
pollIntervalMs = taskDefaults.pollIntervalMs; // 500
|
|
234
|
+
if (maxPollAttempts === 300)
|
|
235
|
+
maxPollAttempts = taskDefaults.maxPollAttempts; // 200
|
|
236
|
+
}
|
|
237
|
+
// clamp
|
|
238
|
+
pollIntervalMs = Math.min(900000, Math.max(500, pollIntervalMs));
|
|
239
|
+
maxPollAttempts = Math.min(1000, Math.max(1, maxPollAttempts));
|
|
160
240
|
const audioBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
|
|
161
241
|
// Endpoints (polling API)
|
|
162
242
|
let url;
|
|
@@ -177,9 +257,7 @@ class PalatineSpeechNode {
|
|
|
177
257
|
itemIndex: i,
|
|
178
258
|
});
|
|
179
259
|
}
|
|
180
|
-
const promptToSend = summarizeTask === 'meeting_summary'
|
|
181
|
-
? '*'
|
|
182
|
-
: (summarizePromptRaw || '').trim() || '*';
|
|
260
|
+
const promptToSend = summarizeTask === 'meeting_summary' ? '*' : (summarizePromptRaw || '').trim() || '*';
|
|
183
261
|
url = `${baseUrl}/api/v1/ai_service/summarize_file`;
|
|
184
262
|
qs = {
|
|
185
263
|
task: summarizeTask,
|
|
@@ -195,9 +273,11 @@ class PalatineSpeechNode {
|
|
|
195
273
|
const form = new FormData();
|
|
196
274
|
const fileName = binaryData.fileName || 'audio';
|
|
197
275
|
const mimeType = binaryData.mimeType || 'audio/mpeg';
|
|
198
|
-
const u8 = new Uint8Array(audioBuffer);
|
|
276
|
+
const u8 = new Uint8Array(audioBuffer);
|
|
199
277
|
form.append('file', new Blob([u8], { type: mimeType }), fileName);
|
|
200
|
-
|
|
278
|
+
if (model) {
|
|
279
|
+
form.append('model', model);
|
|
280
|
+
}
|
|
201
281
|
const createOptions = {
|
|
202
282
|
method: 'POST',
|
|
203
283
|
url,
|
|
@@ -237,8 +317,10 @@ class PalatineSpeechNode {
|
|
|
237
317
|
const result = {
|
|
238
318
|
task,
|
|
239
319
|
source_file: binaryData.fileName,
|
|
240
|
-
model_used: model,
|
|
241
320
|
};
|
|
321
|
+
if (task === 'transcribe' && model) {
|
|
322
|
+
result.model_used = model;
|
|
323
|
+
}
|
|
242
324
|
if (task === 'transcribe') {
|
|
243
325
|
result.transcription =
|
|
244
326
|
typeof finalResponse === 'string'
|
|
@@ -272,7 +354,6 @@ class PalatineSpeechNode {
|
|
|
272
354
|
});
|
|
273
355
|
continue;
|
|
274
356
|
}
|
|
275
|
-
// If it's already a NodeOperationError/NodeApiError — rethrow
|
|
276
357
|
throw error;
|
|
277
358
|
}
|
|
278
359
|
}
|
package/package.json
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-paaalleeee",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.1",
|
|
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"
|