@layercode/js-sdk 2.3.2 → 2.4.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.
|
@@ -3692,8 +3692,8 @@ class LayercodeClient {
|
|
|
3692
3692
|
_initializeVAD() {
|
|
3693
3693
|
var _a;
|
|
3694
3694
|
console.log('initializing VAD', { pushToTalkEnabled: this.pushToTalkEnabled, canInterrupt: this.canInterrupt, vadConfig: this.vadConfig });
|
|
3695
|
-
// If we're in push to talk mode, we don't need to use the VAD model
|
|
3696
|
-
if (this.pushToTalkEnabled) {
|
|
3695
|
+
// If we're in push to talk mode or mute mode, we don't need to use the VAD model
|
|
3696
|
+
if (this.pushToTalkEnabled || this.isMuted) {
|
|
3697
3697
|
return;
|
|
3698
3698
|
}
|
|
3699
3699
|
// Check if VAD is disabled
|
|
@@ -3842,6 +3842,9 @@ class LayercodeClient {
|
|
|
3842
3842
|
await this._clientInterruptAgentReplay();
|
|
3843
3843
|
this._wsSend({ type: 'client.response.text', content: text });
|
|
3844
3844
|
}
|
|
3845
|
+
async sendClientResponseData(data) {
|
|
3846
|
+
this._wsSend({ type: 'client.response.data', data: data });
|
|
3847
|
+
}
|
|
3845
3848
|
/**
|
|
3846
3849
|
* Handles incoming WebSocket messages
|
|
3847
3850
|
* @param {MessageEvent} event - The WebSocket message event
|
|
@@ -4452,6 +4455,7 @@ class LayercodeClient {
|
|
|
4452
4455
|
this.isMuted = true;
|
|
4453
4456
|
console.log('Microphone muted');
|
|
4454
4457
|
this.options.onMuteStateChange(true);
|
|
4458
|
+
this.stopVad();
|
|
4455
4459
|
}
|
|
4456
4460
|
}
|
|
4457
4461
|
/**
|
|
@@ -4462,6 +4466,7 @@ class LayercodeClient {
|
|
|
4462
4466
|
this.isMuted = false;
|
|
4463
4467
|
console.log('Microphone unmuted');
|
|
4464
4468
|
this.options.onMuteStateChange(false);
|
|
4469
|
+
this._initializeVAD();
|
|
4465
4470
|
}
|
|
4466
4471
|
}
|
|
4467
4472
|
}
|