n8n-nodes-soniox-api 0.2.1 → 0.2.2
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.
|
@@ -64,17 +64,39 @@ class Soniox {
|
|
|
64
64
|
try {
|
|
65
65
|
const response = await GenericFunctions_1.sonioxApiRequest.call(this, 'GET', '/models');
|
|
66
66
|
const models = Array.isArray(response) ? response : response.models || [];
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
// Transform models into options
|
|
68
|
+
const options = models.map((model) => {
|
|
69
|
+
// Handle different response formats
|
|
70
|
+
let modelId;
|
|
71
|
+
let modelName;
|
|
72
|
+
let modelDescription;
|
|
73
|
+
if (typeof model === 'string') {
|
|
74
|
+
// Simple string format
|
|
75
|
+
modelId = model;
|
|
76
|
+
modelName = model;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// Object format
|
|
80
|
+
modelId = (model.model_id || model.id || model.name || model.value);
|
|
81
|
+
modelName = (model.name || model.display_name || modelId);
|
|
82
|
+
modelDescription = model.description;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
name: modelName,
|
|
86
|
+
value: modelId,
|
|
87
|
+
description: modelDescription || modelName,
|
|
88
|
+
};
|
|
89
|
+
}).filter((option) => option.value); // Remove invalid entries
|
|
90
|
+
if (options.length === 0) {
|
|
91
|
+
throw new Error('No models returned from API');
|
|
92
|
+
}
|
|
93
|
+
return options;
|
|
72
94
|
}
|
|
73
95
|
catch {
|
|
74
96
|
// Fallback if API fails
|
|
75
97
|
return [
|
|
76
|
-
{ name: '
|
|
77
|
-
{ name: '
|
|
98
|
+
{ name: 'English v2 Low Latency', value: 'en_v2_lowlatency', description: 'English v2 Low Latency model' },
|
|
99
|
+
{ name: 'English v2', value: 'en_v2', description: 'English v2 model' },
|
|
78
100
|
];
|
|
79
101
|
}
|
|
80
102
|
},
|
|
@@ -166,12 +188,23 @@ class Soniox {
|
|
|
166
188
|
const fileId = this.getNodeParameter('fileId', i);
|
|
167
189
|
const model = this.getNodeParameter('model', i, '');
|
|
168
190
|
const additionalFields = this.getNodeParameter('additionalFields', i, {});
|
|
191
|
+
// Validate fileId (must be UUID)
|
|
192
|
+
if (!fileId || !fileId.trim()) {
|
|
193
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'File ID is required', { itemIndex: i });
|
|
194
|
+
}
|
|
195
|
+
// UUID format validation
|
|
196
|
+
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
197
|
+
if (!uuidRegex.test(fileId.trim())) {
|
|
198
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `File ID must be a valid UUID. Received: "${fileId}". Please use the file_id from the File Upload operation.`, { itemIndex: i });
|
|
199
|
+
}
|
|
200
|
+
// Validate model
|
|
201
|
+
if (!model || !model.trim()) {
|
|
202
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Model is required. Please select a model from the dropdown.', { itemIndex: i });
|
|
203
|
+
}
|
|
169
204
|
const body = {
|
|
170
|
-
file_id: fileId,
|
|
205
|
+
file_id: fileId.trim(),
|
|
206
|
+
model: model.trim(),
|
|
171
207
|
};
|
|
172
|
-
if (model) {
|
|
173
|
-
body.model = model;
|
|
174
|
-
}
|
|
175
208
|
if (additionalFields.language) {
|
|
176
209
|
body.language = additionalFields.language;
|
|
177
210
|
}
|
|
@@ -60,13 +60,15 @@ exports.transcriptionFields = [
|
|
|
60
60
|
loadOptionsMethod: 'getModels',
|
|
61
61
|
},
|
|
62
62
|
default: '',
|
|
63
|
+
required: true,
|
|
63
64
|
displayOptions: {
|
|
64
65
|
show: {
|
|
65
66
|
resource: ['transcription'],
|
|
66
67
|
operation: ['create'],
|
|
67
68
|
},
|
|
68
69
|
},
|
|
69
|
-
description: 'The model to use for transcription (loaded from API)',
|
|
70
|
+
description: 'The model to use for transcription (loaded from Soniox API)',
|
|
71
|
+
placeholder: 'Select a model',
|
|
70
72
|
},
|
|
71
73
|
{
|
|
72
74
|
displayName: 'Additional Fields',
|