n8n-nodes-soniox-api 0.5.2 → 0.5.4
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 +1 -1
- package/dist/nodes/Soniox/Soniox.node.js +39 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -116,7 +116,7 @@ The simplest way to transcribe audio - just **one node**:
|
|
|
116
116
|
- Resource: `Transcription`
|
|
117
117
|
- Operation: `Transcribe`
|
|
118
118
|
- Binary Property: `data`
|
|
119
|
-
- Model: `
|
|
119
|
+
- Model: `Realtime or Async` (or any model from dropdown)
|
|
120
120
|
- Additional Fields:
|
|
121
121
|
- Language: `en` (optional, auto-detected if not specified)
|
|
122
122
|
- Context: Domain-specific terms (optional)
|
|
@@ -195,6 +195,9 @@ class Soniox {
|
|
|
195
195
|
const model = this.getNodeParameter('model', i, '');
|
|
196
196
|
const additionalFields = this.getNodeParameter('additionalFields', i, {});
|
|
197
197
|
const options = this.getNodeParameter('options', i, {});
|
|
198
|
+
// CRITICAL: Remove audio_url from additionalFields if somehow present
|
|
199
|
+
delete additionalFields.audio_url;
|
|
200
|
+
delete additionalFields.audioUrl;
|
|
198
201
|
// Get binary data
|
|
199
202
|
const binaryData = items[i].binary;
|
|
200
203
|
if (!binaryData || !binaryData[binaryPropertyName]) {
|
|
@@ -215,8 +218,19 @@ class Soniox {
|
|
|
215
218
|
},
|
|
216
219
|
},
|
|
217
220
|
};
|
|
221
|
+
// DEBUG: Log upload attempt
|
|
222
|
+
console.log('[SONIOX DEBUG] Starting file upload...');
|
|
223
|
+
console.log('[SONIOX DEBUG] File name:', uploadFileName);
|
|
224
|
+
console.log('[SONIOX DEBUG] Content type:', binaryData[binaryPropertyName].mimeType);
|
|
225
|
+
console.log('[SONIOX DEBUG] File size:', binaryData[binaryPropertyName].fileSize || 'unknown');
|
|
218
226
|
const uploadResponse = await GenericFunctions_1.sonioxApiRequest.call(this, 'POST', '/files', {}, {}, undefined, { formData });
|
|
227
|
+
// DEBUG: Log upload response
|
|
228
|
+
console.log('[SONIOX DEBUG] Upload response:', JSON.stringify(uploadResponse, null, 2));
|
|
219
229
|
const fileId = uploadResponse.file_id;
|
|
230
|
+
if (!fileId) {
|
|
231
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `File upload failed: no file_id in response. Response: ${JSON.stringify(uploadResponse)}`, { itemIndex: i });
|
|
232
|
+
}
|
|
233
|
+
console.log('[SONIOX DEBUG] File uploaded successfully, file_id:', fileId);
|
|
220
234
|
// Step 2: Create transcription
|
|
221
235
|
const body = {
|
|
222
236
|
file_id: fileId,
|
|
@@ -241,8 +255,15 @@ class Soniox {
|
|
|
241
255
|
if (additionalFields.includeNonFinal) {
|
|
242
256
|
body.include_nonfinal = additionalFields.includeNonFinal;
|
|
243
257
|
}
|
|
244
|
-
// Ensure
|
|
258
|
+
// CRITICAL: Ensure NO audio_url is sent (API requires ONLY file_id OR audio_url, not both)
|
|
259
|
+
// Delete from body in all possible forms
|
|
245
260
|
delete body.audio_url;
|
|
261
|
+
delete body.audioUrl;
|
|
262
|
+
delete body[' audio_url'];
|
|
263
|
+
// Also ensure file_id is present and valid
|
|
264
|
+
if (!body.file_id) {
|
|
265
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `file_id is missing from request body. File upload may have failed.`, { itemIndex: i });
|
|
266
|
+
}
|
|
246
267
|
const createResponse = await GenericFunctions_1.sonioxApiRequest.call(this, 'POST', '/transcriptions', body);
|
|
247
268
|
const transcriptionId = createResponse.transcription_id || createResponse.id;
|
|
248
269
|
if (!transcriptionId) {
|
|
@@ -287,6 +308,9 @@ class Soniox {
|
|
|
287
308
|
const fileId = this.getNodeParameter('fileId', i);
|
|
288
309
|
const model = this.getNodeParameter('model', i, '');
|
|
289
310
|
const additionalFields = this.getNodeParameter('additionalFields', i, {});
|
|
311
|
+
// CRITICAL: Remove audio_url from additionalFields if somehow present
|
|
312
|
+
delete additionalFields.audio_url;
|
|
313
|
+
delete additionalFields.audioUrl;
|
|
290
314
|
// Validate fileId (must be UUID)
|
|
291
315
|
if (!fileId || !fileId.trim()) {
|
|
292
316
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'File ID is required', { itemIndex: i });
|
|
@@ -326,8 +350,10 @@ class Soniox {
|
|
|
326
350
|
if (additionalFields.includeNonFinal) {
|
|
327
351
|
body.include_nonfinal = additionalFields.includeNonFinal;
|
|
328
352
|
}
|
|
329
|
-
// Ensure
|
|
353
|
+
// CRITICAL: Ensure NO audio_url is sent (API requires ONLY file_id OR audio_url, not both)
|
|
330
354
|
delete body.audio_url;
|
|
355
|
+
delete body.audioUrl;
|
|
356
|
+
delete body[' audio_url'];
|
|
331
357
|
const response = await GenericFunctions_1.sonioxApiRequest.call(this, 'POST', '/transcriptions', body);
|
|
332
358
|
returnData.push({ json: response });
|
|
333
359
|
}
|
|
@@ -336,6 +362,9 @@ class Soniox {
|
|
|
336
362
|
const model = this.getNodeParameter('model', i, '');
|
|
337
363
|
const additionalFields = this.getNodeParameter('additionalFields', i, {});
|
|
338
364
|
const options = this.getNodeParameter('options', i, {});
|
|
365
|
+
// CRITICAL: Remove audio_url from additionalFields if somehow present
|
|
366
|
+
delete additionalFields.audio_url;
|
|
367
|
+
delete additionalFields.audioUrl;
|
|
339
368
|
const maxWaitTime = options.maxWaitTime || 300;
|
|
340
369
|
const checkInterval = options.checkInterval || 5;
|
|
341
370
|
if (!fileId || !fileId.trim()) {
|
|
@@ -362,8 +391,15 @@ class Soniox {
|
|
|
362
391
|
body.enable_speaker_diarization = additionalFields.enableSpeakerDiarization;
|
|
363
392
|
if (additionalFields.includeNonFinal)
|
|
364
393
|
body.include_nonfinal = additionalFields.includeNonFinal;
|
|
365
|
-
// Ensure
|
|
394
|
+
// CRITICAL: Ensure NO audio_url is sent (API requires ONLY file_id OR audio_url, not both)
|
|
395
|
+
// Delete from body in all possible forms
|
|
366
396
|
delete body.audio_url;
|
|
397
|
+
delete body.audioUrl;
|
|
398
|
+
delete body[' audio_url'];
|
|
399
|
+
// Also ensure file_id is present and valid
|
|
400
|
+
if (!body.file_id) {
|
|
401
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `file_id is missing from request body. Upload may have failed.`, { itemIndex: i });
|
|
402
|
+
}
|
|
367
403
|
const createResponse = await GenericFunctions_1.sonioxApiRequest.call(this, 'POST', '/transcriptions', body);
|
|
368
404
|
const transcriptionId = createResponse.transcription_id || createResponse.id;
|
|
369
405
|
if (!transcriptionId) {
|