@hivegpt/hiveai-angular 0.0.459 → 0.0.461
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/bundles/hivegpt-hiveai-angular.umd.js +20 -13
- package/bundles/hivegpt-hiveai-angular.umd.js.map +1 -1
- package/bundles/hivegpt-hiveai-angular.umd.min.js +1 -1
- package/bundles/hivegpt-hiveai-angular.umd.min.js.map +1 -1
- package/esm2015/lib/components/voice-agent/services/daily-voice-client.service.js +7 -4
- package/esm2015/lib/components/voice-agent/services/voice-agent.service.js +15 -11
- package/fesm2015/hivegpt-hiveai-angular.js +20 -13
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/lib/components/voice-agent/services/daily-voice-client.service.d.ts.map +1 -1
- package/lib/components/voice-agent/services/voice-agent.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1460,8 +1460,8 @@
|
|
|
1460
1460
|
source.connect(analyser_1);
|
|
1461
1461
|
this.remoteAudioContext = ctx;
|
|
1462
1462
|
var dataArray_1 = new Uint8Array(analyser_1.frequencyBinCount);
|
|
1463
|
-
var THRESHOLD_1 =
|
|
1464
|
-
var SILENCE_MS_1 =
|
|
1463
|
+
var THRESHOLD_1 = 5;
|
|
1464
|
+
var SILENCE_MS_1 = 1500;
|
|
1465
1465
|
var lastSoundTime_1 = 0;
|
|
1466
1466
|
var isSpeaking_1 = false;
|
|
1467
1467
|
var poll_1 = function () {
|
|
@@ -1479,7 +1479,10 @@
|
|
|
1479
1479
|
if (!isSpeaking_1) {
|
|
1480
1480
|
isSpeaking_1 = true;
|
|
1481
1481
|
console.log("[VoiceDebug] Bot audio energy detected (speaking=true) \u2014 avg=" + avg.toFixed(1) + " \u2014 " + new Date().toISOString());
|
|
1482
|
-
_this.ngZone.run(function () {
|
|
1482
|
+
_this.ngZone.run(function () {
|
|
1483
|
+
_this.userSpeakingSubject.next(false);
|
|
1484
|
+
_this.speakingSubject.next(true);
|
|
1485
|
+
});
|
|
1483
1486
|
}
|
|
1484
1487
|
}
|
|
1485
1488
|
else if (isSpeaking_1 && now - lastSoundTime_1 > SILENCE_MS_1) {
|
|
@@ -1753,32 +1756,36 @@
|
|
|
1753
1756
|
.subscribe(function (stream) {
|
|
1754
1757
|
_this.audioAnalyzer.start(stream);
|
|
1755
1758
|
});
|
|
1756
|
-
// Speaking state from Daily only (NOT from AudioAnalyzer).
|
|
1757
|
-
// User speaking overrides bot talking: if user speaks while bot talks, state = listening.
|
|
1758
1759
|
this.subscriptions.add(this.dailyClient.userSpeaking$.subscribe(function (s) { return _this.isUserSpeakingSubject.next(s); }));
|
|
1759
1760
|
this.subscriptions.add(rxjs.combineLatest([
|
|
1760
1761
|
this.dailyClient.speaking$,
|
|
1761
1762
|
this.dailyClient.userSpeaking$,
|
|
1762
1763
|
]).subscribe(function (_a) {
|
|
1763
1764
|
var _b = __read(_a, 2), bot = _b[0], user = _b[1];
|
|
1765
|
+
var current = _this.callStateSubject.value;
|
|
1766
|
+
if (current === 'connecting' && !bot) {
|
|
1767
|
+
return;
|
|
1768
|
+
}
|
|
1769
|
+
if (current === 'connecting' && bot) {
|
|
1770
|
+
console.log("[VoiceDebug] First bot audio arrived \u2014 transitioning to talking \u2014 " + new Date().toISOString());
|
|
1771
|
+
_this.callStartTime = Date.now();
|
|
1772
|
+
_this.startDurationTimer();
|
|
1773
|
+
_this.callStateSubject.next('talking');
|
|
1774
|
+
return;
|
|
1775
|
+
}
|
|
1764
1776
|
if (user) {
|
|
1765
1777
|
_this.callStateSubject.next('listening');
|
|
1766
1778
|
}
|
|
1767
1779
|
else if (bot) {
|
|
1768
|
-
console.log("[VoiceDebug] Agent starts speaking (callState \u2192 talking) \u2014 " + new Date().toISOString());
|
|
1769
1780
|
_this.callStateSubject.next('talking');
|
|
1770
1781
|
}
|
|
1771
|
-
else if (
|
|
1772
|
-
_this.callStateSubject.value === 'listening') {
|
|
1782
|
+
else if (current === 'talking' || current === 'listening') {
|
|
1773
1783
|
_this.callStateSubject.next('connected');
|
|
1774
1784
|
}
|
|
1775
1785
|
}));
|
|
1776
1786
|
this.subscriptions.add(this.dailyClient.micMuted$.subscribe(function (muted) { return _this.isMicMutedSubject.next(muted); }));
|
|
1777
|
-
console.log("[VoiceDebug] Room
|
|
1778
|
-
this.
|
|
1779
|
-
this.statusTextSubject.next('Connected');
|
|
1780
|
-
this.callStartTime = Date.now();
|
|
1781
|
-
this.startDurationTimer();
|
|
1787
|
+
console.log("[VoiceDebug] Room joined, staying in connecting until bot speaks \u2014 " + new Date().toISOString());
|
|
1788
|
+
this.statusTextSubject.next('Connecting...');
|
|
1782
1789
|
return [2 /*return*/];
|
|
1783
1790
|
}
|
|
1784
1791
|
});
|