uneeq-js 2.49.1 → 2.50.0
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.
|
@@ -53,6 +53,12 @@ export interface UneeqOptions {
|
|
|
53
53
|
* This option specifies what the default voice input mode will be.
|
|
54
54
|
*/
|
|
55
55
|
voiceInputMode: VoiceInputMode | string;
|
|
56
|
+
/**
|
|
57
|
+
* This option specifies whether VAD should be used when voiceInputMode is set to SPEECH_RECOGNITION.
|
|
58
|
+
* If set to false, then pauseSpeechRecognition and resumeSpeechRecognition must be called to capture the users audio.
|
|
59
|
+
* If set to true, or omitted, then the users audio will be captured automatically.
|
|
60
|
+
*/
|
|
61
|
+
enableVad?: boolean;
|
|
56
62
|
/**
|
|
57
63
|
* Resume user session if available.
|
|
58
64
|
*/
|
package/dist/umd/index.js
CHANGED
|
@@ -4074,7 +4074,8 @@ class Uneeq {
|
|
|
4074
4074
|
locales: this.options.speechToTextLocales || '',
|
|
4075
4075
|
hintPhrases: this.options.speechRecognitionHintPhrases || '',
|
|
4076
4076
|
jwtToken: token,
|
|
4077
|
-
chatMetadata: this.chatMetadata
|
|
4077
|
+
chatMetadata: this.chatMetadata,
|
|
4078
|
+
enableVad: this.options.enableVad
|
|
4078
4079
|
});
|
|
4079
4080
|
}
|
|
4080
4081
|
else {
|
|
@@ -13314,7 +13315,7 @@ exports.race = race;
|
|
|
13314
13315
|
/***/ ((module) => {
|
|
13315
13316
|
|
|
13316
13317
|
"use strict";
|
|
13317
|
-
module.exports = JSON.parse('{"name":"uneeq-js","version":"2.
|
|
13318
|
+
module.exports = JSON.parse('{"name":"uneeq-js","version":"2.50.0","description":"","main":"dist/index.js","types":"dist/src/index.d.ts","scripts":{"start":"npx webpack -w","test-local":"npx karma start karma.conf.js -logLevel=DEBUG","test":"npx karma start --browsers ChromeHeadless --single-run","test:windows":"karma start karma.conf.js","build":"webpack --config webpack.config.prod.js && webpack --config webpack.config.umd.js","lint":"npx tslint -p tsconfig.json --fix","docs":"npx typedoc --options"},"files":["dist","!dist/test"],"author":"","license":"ISC","dependencies":{"@stomp/stompjs":"^6.0.0","@uehreka/seriously":"^1.0.1","fast-text-encoding":"^1.0.0","intrinsic-scale":"^3.0.4","onnxruntime-web":"^1.15.1","promjs":"^0.4.1","ring-buffer-ts":"^1.2.0","rxjs":"^7.8.1","rxjs-compat":"^6.6.7","simple-peer":"^9.11.1","webrtc-adapter":"^8.2.3"},"devDependencies":{"@types/dom-mediacapture-record":"^1.0.16","@types/jasmine":"^2.8.8","@types/node":"^10.9.4","fetch-mock":"7.7.3","ignore-styles":"^5.0.1","jasmine":"^5.1.0","jasmine-core":"^5.1.0","karma":"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-requirejs":"^1.1.0","karma-typescript":"^5.5.4","karma-typescript-es6-transform":"^5.5.4","nock":"^9.6.1","requirejs":"^2.3.6","ts-loader":"^9.4.4","ts-node":"^7.0.1","tslint":"^5.11.0","tslint-no-focused-test":"^0.5.0","typedoc":"^0.18.0","typescript":"^5.1.6","webpack":"^5.88.2","webpack-cli":"^5.1.4"}}');
|
|
13318
13319
|
|
|
13319
13320
|
/***/ }),
|
|
13320
13321
|
/* 242 */
|
|
@@ -51279,7 +51280,9 @@ class SpeechHandler {
|
|
|
51279
51280
|
this.digitalHumanSpeaking = false;
|
|
51280
51281
|
this.reconnectWs = true;
|
|
51281
51282
|
this.wsReconnectMessageQueue = [];
|
|
51283
|
+
this.storedTranscription = '';
|
|
51282
51284
|
this.options.assetBasePath = this.options.assetBasePath || defaultAssetPath;
|
|
51285
|
+
this.options.enableVad = this.options.enableVad === undefined ? true : this.options.enableVad;
|
|
51283
51286
|
this.loadSavedAudioHeaders();
|
|
51284
51287
|
this.loadScripts();
|
|
51285
51288
|
this.handleAppMessages();
|
|
@@ -51288,7 +51291,7 @@ class SpeechHandler {
|
|
|
51288
51291
|
this.initWebsocket(this.options);
|
|
51289
51292
|
}
|
|
51290
51293
|
stopRecognition() {
|
|
51291
|
-
if (this.mediaRecorder) {
|
|
51294
|
+
if (this.mediaRecorder && this.mediaRecorder.state === 'recording') {
|
|
51292
51295
|
this.mediaRecorder.stop();
|
|
51293
51296
|
}
|
|
51294
51297
|
if (this.stream) {
|
|
@@ -51402,13 +51405,13 @@ class SpeechHandler {
|
|
|
51402
51405
|
});
|
|
51403
51406
|
}
|
|
51404
51407
|
initVoiceActivityDetection(stream) {
|
|
51405
|
-
logger_1.logger.log(this.logPrefix + 'Going to initialize VAD module.
|
|
51408
|
+
logger_1.logger.log(this.logPrefix + 'Going to initialize VAD module, with enableVad = ' + this.options.enableVad);
|
|
51406
51409
|
real_time_vad_1.MicVAD.new({
|
|
51407
51410
|
onSpeechStart: () => this.onVadSpeechStart(),
|
|
51408
51411
|
onSpeechEnd: () => this.onVadSpeechEnd(),
|
|
51409
51412
|
minSpeechFrames: 1,
|
|
51410
|
-
positiveSpeechThreshold: 0.5,
|
|
51411
|
-
negativeSpeechThreshold: 0.35,
|
|
51413
|
+
positiveSpeechThreshold: this.options.enableVad ? 0.5 : 0,
|
|
51414
|
+
negativeSpeechThreshold: this.options.enableVad ? 0.35 : 0,
|
|
51412
51415
|
redemptionFrames: 8,
|
|
51413
51416
|
assetBasePath: this.options.assetBasePath,
|
|
51414
51417
|
stream: stream,
|
|
@@ -51546,18 +51549,39 @@ class SpeechHandler {
|
|
|
51546
51549
|
}
|
|
51547
51550
|
}
|
|
51548
51551
|
}
|
|
51552
|
+
/*
|
|
51553
|
+
* If the recording is live (VAD), append final STT results until recording is no longer live,
|
|
51554
|
+
then send it as a question.
|
|
51555
|
+
*/
|
|
51549
51556
|
handleTranscriptionResult(result) {
|
|
51550
51557
|
logger_1.logger.log(this.logPrefix + `Speech transcription (${result.confidence} confidence): ${result.transcript}`);
|
|
51551
|
-
|
|
51552
|
-
this.
|
|
51553
|
-
|
|
51554
|
-
|
|
51555
|
-
|
|
51556
|
-
|
|
51557
|
-
|
|
51558
|
+
try {
|
|
51559
|
+
if (this.recordingLive) {
|
|
51560
|
+
if (result.final) {
|
|
51561
|
+
this.storedTranscription += result.transcript;
|
|
51562
|
+
}
|
|
51563
|
+
else if (this.digitalHumanSpeaking) {
|
|
51564
|
+
this.options.api.stopSpeaking();
|
|
51565
|
+
this.digitalHumanSpeaking = false;
|
|
51566
|
+
}
|
|
51567
|
+
}
|
|
51568
|
+
else {
|
|
51569
|
+
if (result.final) {
|
|
51570
|
+
result.transcript = this.storedTranscription + result.transcript;
|
|
51571
|
+
this.options.chatMetadata.userSpokenLocale = result.language_code;
|
|
51572
|
+
this.options.api.avatarAsk(result.transcript, this.options.chatMetadata);
|
|
51573
|
+
this.options.messages.next(new MessageTypes_1.SpeechTranscriptionMessage(result));
|
|
51574
|
+
this.storedTranscription = '';
|
|
51575
|
+
}
|
|
51576
|
+
}
|
|
51577
|
+
if (result.stability > transcriptionStabilityThreshold && !result.final) {
|
|
51578
|
+
result.transcript = this.storedTranscription + result.transcript;
|
|
51579
|
+
this.options.messages.next(new MessageTypes_1.SpeechTranscriptionMessage(result));
|
|
51580
|
+
}
|
|
51558
51581
|
}
|
|
51559
|
-
|
|
51560
|
-
this.options.messages.next(new MessageTypes_1.
|
|
51582
|
+
catch (err) {
|
|
51583
|
+
this.options.messages.next(new MessageTypes_1.SessionErrorMessage('There was an issues processing speech transcription.'));
|
|
51584
|
+
this.storedTranscription = '';
|
|
51561
51585
|
}
|
|
51562
51586
|
}
|
|
51563
51587
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -8,6 +8,12 @@ https://docs.uneeq.io/build-your-own-experience
|
|
|
8
8
|
To use uneeq-js with a typescript version < 3.8, 'skipLibCheck' must be set to true.
|
|
9
9
|
|
|
10
10
|
## Release Notes
|
|
11
|
+
#### 2.50.0
|
|
12
|
+
* Added enableVad as an option which can be used to disable automated voice activity detection.
|
|
13
|
+
|
|
14
|
+
#### 2.49.2
|
|
15
|
+
* Fixed an issue that caused enableMicrophone(false) to error.
|
|
16
|
+
|
|
11
17
|
#### 2.49.1
|
|
12
18
|
* Fixed an issue that caused partial SpeechTranscriptionMessages to be sent.
|
|
13
19
|
|