uneeq-js 3.6.9 → 3.6.11
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/deepgram-stt.d.ts
CHANGED
|
@@ -19,9 +19,17 @@ export interface DeepgramSTTOptions {
|
|
|
19
19
|
fillerWords?: boolean;
|
|
20
20
|
endpointing?: number;
|
|
21
21
|
interruptionWordThreshold?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Safety net timeout in milliseconds.
|
|
24
|
+
* Triggers if no Deepgram events (transcripts/VAD) are received while the user is speaking.
|
|
25
|
+
* This prevents the STT engine from getting "stuck" when Deepgram fails to detect end-of-speech.
|
|
26
|
+
* Recommended: 3000ms - 10000ms. Defaults to 5000ms.
|
|
27
|
+
*/
|
|
28
|
+
safetyNetTimeoutMs?: number;
|
|
22
29
|
echoCancellation?: boolean;
|
|
23
30
|
noiseSuppression?: boolean;
|
|
24
31
|
autoGainControl?: boolean;
|
|
32
|
+
microphoneDeviceId?: string;
|
|
25
33
|
promptMetadata: PromptMetadata;
|
|
26
34
|
messages: Subject<UneeqMessage>;
|
|
27
35
|
sendMessage: (msg: DataChannelMessage) => void;
|
|
@@ -29,10 +37,8 @@ export interface DeepgramSTTOptions {
|
|
|
29
37
|
export declare class DeepgramSTT implements SpeechRecognitionInterface {
|
|
30
38
|
private readonly options;
|
|
31
39
|
private connection;
|
|
32
|
-
private
|
|
33
|
-
private isPaused;
|
|
40
|
+
private state;
|
|
34
41
|
private shouldReconnect;
|
|
35
|
-
private isConnecting;
|
|
36
42
|
private microphone;
|
|
37
43
|
private stream;
|
|
38
44
|
private reconnectAttempts;
|
|
@@ -62,7 +68,35 @@ export declare class DeepgramSTT implements SpeechRecognitionInterface {
|
|
|
62
68
|
private stopMicrophone;
|
|
63
69
|
private setupEventHandlers;
|
|
64
70
|
private handleAppMessages;
|
|
71
|
+
/**
|
|
72
|
+
* Primary handler for incoming Deepgram transcript events.
|
|
73
|
+
* Extracts transcript data, processes chunks, and updates speaking states.
|
|
74
|
+
* @param data - The live transcription response from Deepgram
|
|
75
|
+
*/
|
|
65
76
|
private handleTranscript;
|
|
77
|
+
/**
|
|
78
|
+
* Processes a single transcript chunk, accumulating text and confidence scores.
|
|
79
|
+
* @param transcript - The transcript text from the current chunk
|
|
80
|
+
* @param confidence - The confidence score for the current chunk
|
|
81
|
+
* @param isFinal - Whether Deepgram has marked this chunk as final
|
|
82
|
+
* @param speechFinal - Whether Deepgram has detected the end of a speech segment
|
|
83
|
+
*/
|
|
84
|
+
private processTranscriptChunk;
|
|
85
|
+
/**
|
|
86
|
+
* Evaluates whether the user's speech should trigger an interruption of the digital human
|
|
87
|
+
* and updates the internal speaking states for Renny and the UI.
|
|
88
|
+
* @param transcript - The current transcript text
|
|
89
|
+
* @param speechFinal - Whether the current segment is marked as speech_final
|
|
90
|
+
*/
|
|
91
|
+
private updateSpeakingAndInterruptionState;
|
|
92
|
+
/**
|
|
93
|
+
* Emits transcription results to the client (for closed captions) and sends
|
|
94
|
+
* chat prompts to Renny if the utterance has reached a final state.
|
|
95
|
+
* @param transcript - The current segment transcript
|
|
96
|
+
* @param confidence - The confidence score for the current segment
|
|
97
|
+
* @param speechFinal - Whether the segment is speech_final
|
|
98
|
+
*/
|
|
99
|
+
private emitTranscriptionResult;
|
|
66
100
|
/**
|
|
67
101
|
* Handle UtteranceEnd event from Deepgram.
|
|
68
102
|
* This fires when Deepgram detects a gap in word timings, even in noisy environments
|
|
@@ -75,7 +109,7 @@ export declare class DeepgramSTT implements SpeechRecognitionInterface {
|
|
|
75
109
|
*/
|
|
76
110
|
private resetSafetyNetTimeout;
|
|
77
111
|
/**
|
|
78
|
-
* Safety net trigger - called when no Deepgram events received for
|
|
112
|
+
* Safety net trigger - called when no Deepgram events received for safetyNetTimeoutMs
|
|
79
113
|
* while in a speaking state with accumulated transcript. This handles truly stuck states.
|
|
80
114
|
*/
|
|
81
115
|
private triggerSafetyNet;
|
|
@@ -85,6 +119,12 @@ export declare class DeepgramSTT implements SpeechRecognitionInterface {
|
|
|
85
119
|
* @param source - Description of what triggered this (for logging)
|
|
86
120
|
*/
|
|
87
121
|
private sendAccumulatedTranscript;
|
|
122
|
+
/**
|
|
123
|
+
* Check if a string ends with sentence-ending punctuation.
|
|
124
|
+
* @param text - The text to check
|
|
125
|
+
* @returns true if the text ends with punctuation (. ! ? etc.)
|
|
126
|
+
*/
|
|
127
|
+
private endsWithPunctuation;
|
|
88
128
|
/**
|
|
89
129
|
* Reset accumulated transcript and confidence state.
|
|
90
130
|
*/
|