@absolutejs/voice-deepgram 0.0.15 → 0.0.17
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/dist/index.js +5 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2271,6 +2271,7 @@ var resolveErrorMessage = (error) => {
|
|
|
2271
2271
|
}
|
|
2272
2272
|
return "Deepgram stream error";
|
|
2273
2273
|
};
|
|
2274
|
+
var omitUndefined = (value) => Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined));
|
|
2274
2275
|
var buildLiveOptions = (config, format) => {
|
|
2275
2276
|
const options = {
|
|
2276
2277
|
channels: format.channels,
|
|
@@ -2313,7 +2314,7 @@ var buildLiveOptions = (config, format) => {
|
|
|
2313
2314
|
if (keyterm !== undefined) {
|
|
2314
2315
|
options.keyterm = keyterm;
|
|
2315
2316
|
}
|
|
2316
|
-
return options;
|
|
2317
|
+
return omitUndefined(options);
|
|
2317
2318
|
};
|
|
2318
2319
|
var openConnection = (client, config, liveOptions) => {
|
|
2319
2320
|
const listen = client.listen;
|
|
@@ -2331,6 +2332,7 @@ var openConnection = (client, config, liveOptions) => {
|
|
|
2331
2332
|
var deepgram = (config) => ({
|
|
2332
2333
|
kind: "stt",
|
|
2333
2334
|
open: (options) => {
|
|
2335
|
+
const emitsNativeEndOfTurn = String(config.model).startsWith("flux");
|
|
2334
2336
|
const client = createClient(config.apiKey, {
|
|
2335
2337
|
global: {
|
|
2336
2338
|
websocket: {
|
|
@@ -2365,7 +2367,7 @@ var deepgram = (config) => ({
|
|
|
2365
2367
|
});
|
|
2366
2368
|
connection.on(LiveTranscriptionEvents.Transcript, (payload) => {
|
|
2367
2369
|
const type = typeof payload.type === "string" ? payload.type : "Results";
|
|
2368
|
-
if (type === "UtteranceEnd" || type === "EndOfTurn" || type === "EagerEndOfTurn") {
|
|
2370
|
+
if (emitsNativeEndOfTurn && (type === "UtteranceEnd" || type === "EndOfTurn" || type === "EagerEndOfTurn")) {
|
|
2369
2371
|
emit(listeners, "endOfTurn", {
|
|
2370
2372
|
receivedAt: Date.now(),
|
|
2371
2373
|
reason: "vendor",
|
|
@@ -2399,7 +2401,7 @@ var deepgram = (config) => ({
|
|
|
2399
2401
|
type: "partial"
|
|
2400
2402
|
});
|
|
2401
2403
|
}
|
|
2402
|
-
if (payload.speech_final === true) {
|
|
2404
|
+
if (emitsNativeEndOfTurn && payload.speech_final === true) {
|
|
2403
2405
|
emit(listeners, "endOfTurn", {
|
|
2404
2406
|
receivedAt: Date.now(),
|
|
2405
2407
|
reason: "vendor",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolutejs/voice-deepgram",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "Deepgram speech-to-text adapter for @absolutejs/voice",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"typecheck": "bun run tsc --noEmit"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@absolutejs/voice": "0.0.
|
|
31
|
+
"@absolutejs/voice": "0.0.15",
|
|
32
32
|
"@deepgram/sdk": "^4.11.2",
|
|
33
33
|
"ws": "^8.18.3"
|
|
34
34
|
},
|