n8n-nodes-berget-mk 0.4.13 → 0.4.14
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.
|
@@ -199,18 +199,42 @@ async function executeSpeech(context, itemIndex) {
|
|
|
199
199
|
// segments and word timestamps. The raw segments/words/timestamps are
|
|
200
200
|
// still preserved on the result object so power users can drill into
|
|
201
201
|
// them when needed.
|
|
202
|
-
if (options.diarize &&
|
|
203
|
-
data
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
data.speaker_transcript = transcript;
|
|
202
|
+
if (options.diarize && data && typeof data === 'object') {
|
|
203
|
+
const segments = extractSegments(data);
|
|
204
|
+
if (segments) {
|
|
205
|
+
const transcript = buildSpeakerTranscript(segments);
|
|
206
|
+
if (transcript) {
|
|
207
|
+
data.speaker_transcript = transcript;
|
|
208
|
+
}
|
|
210
209
|
}
|
|
211
210
|
}
|
|
212
211
|
return data;
|
|
213
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Pull the segments array out of Berget's transcription response. Berget has
|
|
215
|
+
* been observed to return the segments in two different shapes:
|
|
216
|
+
*
|
|
217
|
+
* Shape A (flat): { segments: [...], language, text }
|
|
218
|
+
* Shape B (nested): { segments: { segments: [...], ... }, language, text }
|
|
219
|
+
*
|
|
220
|
+
* Shape B is what the API returns for verbose_json with diarize=true (as of
|
|
221
|
+
* 2026-04). We check both so the speaker_transcript builder works regardless
|
|
222
|
+
* of which shape we get, and so future API changes that flatten or re-nest
|
|
223
|
+
* don't silently break the output.
|
|
224
|
+
*/
|
|
225
|
+
function extractSegments(data) {
|
|
226
|
+
const top = data.segments;
|
|
227
|
+
if (Array.isArray(top)) {
|
|
228
|
+
return top;
|
|
229
|
+
}
|
|
230
|
+
if (top && typeof top === 'object') {
|
|
231
|
+
const inner = top.segments;
|
|
232
|
+
if (Array.isArray(inner)) {
|
|
233
|
+
return inner;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
214
238
|
/**
|
|
215
239
|
* Build a "SPEAKER_00:\n...text...\n\nSPEAKER_01:\n..." style transcript
|
|
216
240
|
* by walking the segments array, grouping consecutive segments that share
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-berget-mk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.14",
|
|
4
4
|
"description": "n8n community node for Berget AI. Multi-resource action node (chat, OCR, rerank, speech-to-text) plus Chat Model and Embeddings Model sub-nodes that plug into n8n's built-in AI Agent and Vector Store nodes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|