@hivegpt/hiveai-angular 0.0.428 → 0.0.429
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 +23 -24
- 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/voice-agent.service.js +2 -3
- package/fesm2015/hivegpt-hiveai-angular.js +1 -2
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/package.json +1 -1
|
@@ -1512,20 +1512,19 @@
|
|
|
1512
1512
|
this.durationSubject.next('0:00');
|
|
1513
1513
|
};
|
|
1514
1514
|
VoiceAgentService.prototype.connect = function (apiUrl, token, botId, conversationId, apiKey, eventToken, eventUrl, domainAuthority) {
|
|
1515
|
-
var _a;
|
|
1516
1515
|
return __awaiter(this, void 0, void 0, function () {
|
|
1517
1516
|
var baseUrl, postUrl, headers, res, json, wsUrl, error_1;
|
|
1518
1517
|
var _this = this;
|
|
1519
|
-
return __generator(this, function (
|
|
1520
|
-
switch (
|
|
1518
|
+
return __generator(this, function (_a) {
|
|
1519
|
+
switch (_a.label) {
|
|
1521
1520
|
case 0:
|
|
1522
1521
|
if (this.callStateSubject.value !== 'idle') {
|
|
1523
1522
|
console.warn('Call already in progress');
|
|
1524
1523
|
return [2 /*return*/];
|
|
1525
1524
|
}
|
|
1526
|
-
|
|
1525
|
+
_a.label = 1;
|
|
1527
1526
|
case 1:
|
|
1528
|
-
|
|
1527
|
+
_a.trys.push([1, 4, , 6]);
|
|
1529
1528
|
this.callStateSubject.next('connecting');
|
|
1530
1529
|
this.statusTextSubject.next('Connecting...');
|
|
1531
1530
|
baseUrl = apiUrl.replace(/\/$/, '');
|
|
@@ -1549,14 +1548,14 @@
|
|
|
1549
1548
|
}),
|
|
1550
1549
|
})];
|
|
1551
1550
|
case 2:
|
|
1552
|
-
res =
|
|
1551
|
+
res = _a.sent();
|
|
1553
1552
|
if (!res.ok) {
|
|
1554
1553
|
throw new Error("HTTP " + res.status);
|
|
1555
1554
|
}
|
|
1556
1555
|
return [4 /*yield*/, res.json()];
|
|
1557
1556
|
case 3:
|
|
1558
|
-
json =
|
|
1559
|
-
wsUrl =
|
|
1557
|
+
json = _a.sent();
|
|
1558
|
+
wsUrl = json === null || json === void 0 ? void 0 : json.rn_ws_url;
|
|
1560
1559
|
if (!wsUrl || typeof wsUrl !== 'string') {
|
|
1561
1560
|
throw new Error('No ws_url in response');
|
|
1562
1561
|
}
|
|
@@ -1565,22 +1564,22 @@
|
|
|
1565
1564
|
.pipe(operators.take(1), operators.takeUntil(this.destroy$))
|
|
1566
1565
|
.subscribe(function (roomUrl) { return __awaiter(_this, void 0, void 0, function () {
|
|
1567
1566
|
var err_1;
|
|
1568
|
-
return __generator(this, function (
|
|
1569
|
-
switch (
|
|
1567
|
+
return __generator(this, function (_a) {
|
|
1568
|
+
switch (_a.label) {
|
|
1570
1569
|
case 0:
|
|
1571
|
-
|
|
1570
|
+
_a.trys.push([0, 2, , 4]);
|
|
1572
1571
|
return [4 /*yield*/, this.onRoomCreated(roomUrl)];
|
|
1573
1572
|
case 1:
|
|
1574
|
-
|
|
1573
|
+
_a.sent();
|
|
1575
1574
|
return [3 /*break*/, 4];
|
|
1576
1575
|
case 2:
|
|
1577
|
-
err_1 =
|
|
1576
|
+
err_1 = _a.sent();
|
|
1578
1577
|
console.error('Daily join failed:', err_1);
|
|
1579
1578
|
this.callStateSubject.next('ended');
|
|
1580
1579
|
this.statusTextSubject.next('Connection failed');
|
|
1581
1580
|
return [4 /*yield*/, this.disconnect()];
|
|
1582
1581
|
case 3:
|
|
1583
|
-
|
|
1582
|
+
_a.sent();
|
|
1584
1583
|
throw err_1;
|
|
1585
1584
|
case 4: return [2 /*return*/];
|
|
1586
1585
|
}
|
|
@@ -1597,12 +1596,12 @@
|
|
|
1597
1596
|
this.wsClient.connect(wsUrl);
|
|
1598
1597
|
return [3 /*break*/, 6];
|
|
1599
1598
|
case 4:
|
|
1600
|
-
error_1 =
|
|
1599
|
+
error_1 = _a.sent();
|
|
1601
1600
|
console.error('Error connecting voice agent:', error_1);
|
|
1602
1601
|
this.callStateSubject.next('ended');
|
|
1603
1602
|
return [4 /*yield*/, this.disconnect()];
|
|
1604
1603
|
case 5:
|
|
1605
|
-
|
|
1604
|
+
_a.sent();
|
|
1606
1605
|
this.statusTextSubject.next('Connection failed');
|
|
1607
1606
|
throw error_1;
|
|
1608
1607
|
case 6: return [2 /*return*/];
|
|
@@ -1613,14 +1612,14 @@
|
|
|
1613
1612
|
VoiceAgentService.prototype.onRoomCreated = function (roomUrl) {
|
|
1614
1613
|
return __awaiter(this, void 0, void 0, function () {
|
|
1615
1614
|
var _this = this;
|
|
1616
|
-
return __generator(this, function (
|
|
1617
|
-
switch (
|
|
1615
|
+
return __generator(this, function (_a) {
|
|
1616
|
+
switch (_a.label) {
|
|
1618
1617
|
case 0:
|
|
1619
1618
|
// Connect Daily.js for WebRTC audio
|
|
1620
1619
|
return [4 /*yield*/, this.dailyClient.connect(roomUrl)];
|
|
1621
1620
|
case 1:
|
|
1622
1621
|
// Connect Daily.js for WebRTC audio
|
|
1623
|
-
|
|
1622
|
+
_a.sent();
|
|
1624
1623
|
// Waveform: use local mic stream from Daily client
|
|
1625
1624
|
this.dailyClient.localStream$
|
|
1626
1625
|
.pipe(operators.filter(function (s) { return s != null; }), operators.take(1))
|
|
@@ -1633,8 +1632,8 @@
|
|
|
1633
1632
|
this.subscriptions.add(rxjs.combineLatest([
|
|
1634
1633
|
this.dailyClient.speaking$,
|
|
1635
1634
|
this.dailyClient.userSpeaking$,
|
|
1636
|
-
]).subscribe(function (
|
|
1637
|
-
var
|
|
1635
|
+
]).subscribe(function (_a) {
|
|
1636
|
+
var _b = __read(_a, 2), bot = _b[0], user = _b[1];
|
|
1638
1637
|
if (user) {
|
|
1639
1638
|
_this.callStateSubject.next('listening');
|
|
1640
1639
|
}
|
|
@@ -1658,8 +1657,8 @@
|
|
|
1658
1657
|
};
|
|
1659
1658
|
VoiceAgentService.prototype.disconnect = function () {
|
|
1660
1659
|
return __awaiter(this, void 0, void 0, function () {
|
|
1661
|
-
return __generator(this, function (
|
|
1662
|
-
switch (
|
|
1660
|
+
return __generator(this, function (_a) {
|
|
1661
|
+
switch (_a.label) {
|
|
1663
1662
|
case 0:
|
|
1664
1663
|
this.stopDurationTimer();
|
|
1665
1664
|
this.audioAnalyzer.stop();
|
|
@@ -1667,7 +1666,7 @@
|
|
|
1667
1666
|
return [4 /*yield*/, this.dailyClient.disconnect()];
|
|
1668
1667
|
case 1:
|
|
1669
1668
|
// Daily first, then WebSocket
|
|
1670
|
-
|
|
1669
|
+
_a.sent();
|
|
1671
1670
|
this.wsClient.disconnect();
|
|
1672
1671
|
this.callStateSubject.next('ended');
|
|
1673
1672
|
this.statusTextSubject.next('Call Ended');
|