@hivegpt/hiveai-angular 0.0.575 → 0.0.576
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 +45 -36
- 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 +26 -18
- package/esm2015/lib/components/voice-agent/services/websocket-voice-client.service.js +4 -2
- package/fesm2015/hivegpt-hiveai-angular.js +28 -18
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/lib/components/voice-agent/services/voice-agent.service.d.ts.map +1 -1
- package/lib/components/voice-agent/services/websocket-voice-client.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1438,7 +1438,9 @@
|
|
|
1438
1438
|
reject(new Error('WebSocket connection failed'));
|
|
1439
1439
|
return;
|
|
1440
1440
|
}
|
|
1441
|
-
|
|
1441
|
+
// After onopen, some environments fire onerror spuriously; closing here can
|
|
1442
|
+
// kill the socket before room_created is delivered. Let onclose clean up.
|
|
1443
|
+
console.warn('WebSocketVoiceClient: onerror after open (not forcing disconnect)');
|
|
1442
1444
|
};
|
|
1443
1445
|
ws.onclose = function () {
|
|
1444
1446
|
_this.ws = null;
|
|
@@ -1897,7 +1899,7 @@
|
|
|
1897
1899
|
VoiceAgentService.prototype.connect = function (apiUrl, token, botId, conversationId, apiKey, eventToken, eventId, eventUrl, domainAuthority, usersApiUrl, existingMicStream) {
|
|
1898
1900
|
var _a;
|
|
1899
1901
|
return __awaiter(this, void 0, void 0, function () {
|
|
1900
|
-
var tokenPromise, prepPromise, micPromise, _b, accessToken, _c, postUrl, body, micStream_1, headers, res, json, wsUrl, error_1;
|
|
1902
|
+
var tokenPromise, prepPromise, micPromise, _b, accessToken, _c, postUrl, body, micStream_1, headers, res, json, wsUrl, roomCreatedSub_1, roomJoined, e_1, error_1;
|
|
1901
1903
|
var _this = this;
|
|
1902
1904
|
return __generator(this, function (_d) {
|
|
1903
1905
|
switch (_d.label) {
|
|
@@ -1908,7 +1910,7 @@
|
|
|
1908
1910
|
}
|
|
1909
1911
|
_d.label = 1;
|
|
1910
1912
|
case 1:
|
|
1911
|
-
_d.trys.push([1,
|
|
1913
|
+
_d.trys.push([1, 10, , 12]);
|
|
1912
1914
|
this.callStateSubject.next('connecting');
|
|
1913
1915
|
this.statusTextSubject.next('Connecting...');
|
|
1914
1916
|
tokenPromise = usersApiUrl && common.isPlatformBrowser(this.platformId)
|
|
@@ -1976,48 +1978,55 @@
|
|
|
1976
1978
|
if (!wsUrl || typeof wsUrl !== 'string') {
|
|
1977
1979
|
throw new Error('No ws_url in response');
|
|
1978
1980
|
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
}); });
|
|
2005
|
-
// Connect signaling WebSocket (no audio over WS)
|
|
2006
|
-
return [4 /*yield*/, this.wsClient.connect(wsUrl)];
|
|
1981
|
+
roomJoined = new Promise(function (resolve, reject) {
|
|
1982
|
+
roomCreatedSub_1 = _this.wsClient.roomCreated$
|
|
1983
|
+
.pipe(operators.take(1), operators.takeUntil(_this.destroy$))
|
|
1984
|
+
.subscribe(function (roomUrl) { return __awaiter(_this, void 0, void 0, function () {
|
|
1985
|
+
var err_1;
|
|
1986
|
+
return __generator(this, function (_b) {
|
|
1987
|
+
switch (_b.label) {
|
|
1988
|
+
case 0:
|
|
1989
|
+
_b.trys.push([0, 2, , 3]);
|
|
1990
|
+
return [4 /*yield*/, this.onRoomCreated(roomUrl, micStream_1 !== null && micStream_1 !== void 0 ? micStream_1 : undefined)];
|
|
1991
|
+
case 1:
|
|
1992
|
+
_b.sent();
|
|
1993
|
+
resolve();
|
|
1994
|
+
return [3 /*break*/, 3];
|
|
1995
|
+
case 2:
|
|
1996
|
+
err_1 = _b.sent();
|
|
1997
|
+
console.error('Daily join failed:', err_1);
|
|
1998
|
+
reject(err_1);
|
|
1999
|
+
return [3 /*break*/, 3];
|
|
2000
|
+
case 3: return [2 /*return*/];
|
|
2001
|
+
}
|
|
2002
|
+
});
|
|
2003
|
+
}); }, function (err) { return reject(err); });
|
|
2004
|
+
});
|
|
2005
|
+
_d.label = 5;
|
|
2007
2006
|
case 5:
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
return [3 /*break*/, 8];
|
|
2007
|
+
_d.trys.push([5, 8, , 9]);
|
|
2008
|
+
return [4 /*yield*/, this.wsClient.connect(wsUrl)];
|
|
2011
2009
|
case 6:
|
|
2010
|
+
_d.sent();
|
|
2011
|
+
return [4 /*yield*/, roomJoined];
|
|
2012
|
+
case 7:
|
|
2013
|
+
_d.sent();
|
|
2014
|
+
return [3 /*break*/, 9];
|
|
2015
|
+
case 8:
|
|
2016
|
+
e_1 = _d.sent();
|
|
2017
|
+
roomCreatedSub_1 === null || roomCreatedSub_1 === void 0 ? void 0 : roomCreatedSub_1.unsubscribe();
|
|
2018
|
+
throw e_1;
|
|
2019
|
+
case 9: return [3 /*break*/, 12];
|
|
2020
|
+
case 10:
|
|
2012
2021
|
error_1 = _d.sent();
|
|
2013
2022
|
console.error('Error connecting voice agent:', error_1);
|
|
2014
2023
|
this.callStateSubject.next('ended');
|
|
2015
2024
|
return [4 /*yield*/, this.disconnect()];
|
|
2016
|
-
case
|
|
2025
|
+
case 11:
|
|
2017
2026
|
_d.sent();
|
|
2018
2027
|
this.statusTextSubject.next('Connection failed');
|
|
2019
2028
|
throw error_1;
|
|
2020
|
-
case
|
|
2029
|
+
case 12: return [2 /*return*/];
|
|
2021
2030
|
}
|
|
2022
2031
|
});
|
|
2023
2032
|
});
|