@hivegpt/hiveai-angular 0.0.564 → 0.0.565
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 +19 -11
- 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/chat-drawer/chat-drawer.component.js +8 -8
- package/esm2015/lib/components/conversation.service.js +13 -5
- package/fesm2015/hivegpt-hiveai-angular.js +19 -11
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/lib/components/conversation.service.d.ts +8 -2
- package/lib/components/conversation.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -846,9 +846,16 @@
|
|
|
846
846
|
});
|
|
847
847
|
return timestamp + randomHex;
|
|
848
848
|
};
|
|
849
|
-
|
|
849
|
+
/**
|
|
850
|
+
* Returns a stable conversation id persisted in localStorage.
|
|
851
|
+
*
|
|
852
|
+
* IMPORTANT: call-sites should pass an event-specific scope when needed (e.g. eventId)
|
|
853
|
+
* so switching events does not reuse the previous event's conversation thread.
|
|
854
|
+
*/
|
|
855
|
+
ConversationService.prototype.getKey = function (botId, resetKey, scope) {
|
|
850
856
|
if (resetKey === void 0) { resetKey = false; }
|
|
851
|
-
var
|
|
857
|
+
var normalizedScope = scope != null && String(scope).trim() !== '' ? String(scope).trim() : '';
|
|
858
|
+
var storageKey = "" + this.conversationStorageKeyPrefix + botId + (normalizedScope ? "_" + normalizedScope : '');
|
|
852
859
|
var value = localStorage.getItem(storageKey);
|
|
853
860
|
if (!value || resetKey) {
|
|
854
861
|
value = this.generateKey();
|
|
@@ -856,9 +863,10 @@
|
|
|
856
863
|
}
|
|
857
864
|
return value;
|
|
858
865
|
};
|
|
859
|
-
ConversationService.prototype.getSessionKey = function (sessionId, resetKey) {
|
|
866
|
+
ConversationService.prototype.getSessionKey = function (sessionId, resetKey, scope) {
|
|
860
867
|
if (resetKey === void 0) { resetKey = false; }
|
|
861
|
-
var
|
|
868
|
+
var normalizedScope = scope != null && String(scope).trim() !== '' ? String(scope).trim() : '';
|
|
869
|
+
var storageKey = "" + this.sessionStorageKeyPrefix + sessionId + (normalizedScope ? "_" + normalizedScope : '');
|
|
862
870
|
var value = localStorage.getItem(storageKey);
|
|
863
871
|
if (!value || resetKey) {
|
|
864
872
|
value = this.generateKey();
|
|
@@ -2357,7 +2365,7 @@
|
|
|
2357
2365
|
_this.socketService.connectSocketConnection();
|
|
2358
2366
|
setTimeout(function () {
|
|
2359
2367
|
console.log('YES INIT');
|
|
2360
|
-
var conversation_id = _this.conversationService.getKey(_this.botId);
|
|
2368
|
+
var conversation_id = _this.conversationService.getKey(_this.botId, false, _this.eventId);
|
|
2361
2369
|
_this.socketService.registerUserSpecificHiveSocket(_this.botId, conversation_id, _this.orgId);
|
|
2362
2370
|
setTimeout(function () {
|
|
2363
2371
|
_this.listenSockets();
|
|
@@ -3891,8 +3899,8 @@
|
|
|
3891
3899
|
};
|
|
3892
3900
|
ChatDrawerComponent.prototype.fetchChatHistory = function () {
|
|
3893
3901
|
this.loading = true;
|
|
3894
|
-
this.conversationKey = this.conversationService.getKey(this.botId, false);
|
|
3895
|
-
this.conSessionKey = this.conversationService.getSessionKey(this.botId, false);
|
|
3902
|
+
this.conversationKey = this.conversationService.getKey(this.botId, false, this.eventId);
|
|
3903
|
+
this.conSessionKey = this.conversationService.getSessionKey(this.botId, false, this.eventId);
|
|
3896
3904
|
var url = this.environment.BASE_URL + "/conversations/" + this.conversationKey + "?session_id=" + this.conSessionKey;
|
|
3897
3905
|
var headers = new i1.HttpHeaders({
|
|
3898
3906
|
accept: 'application/json',
|
|
@@ -4442,7 +4450,7 @@
|
|
|
4442
4450
|
console.log(message);
|
|
4443
4451
|
this.feedbackDone = true;
|
|
4444
4452
|
this.showFeedBackIconsIndex = null;
|
|
4445
|
-
var conversation_id = this.conversationService.getKey(this.botId);
|
|
4453
|
+
var conversation_id = this.conversationService.getKey(this.botId, false, this.eventId);
|
|
4446
4454
|
var url = this.environment.AGENTS_API + "/Conversation/coPilot/" + this.botId + "/conversation/" + conversation_id + "/helpful-response";
|
|
4447
4455
|
fetch(url, {
|
|
4448
4456
|
method: 'POST',
|
|
@@ -4895,7 +4903,7 @@
|
|
|
4895
4903
|
this.isContentLoaded = false;
|
|
4896
4904
|
console.log('API call function');
|
|
4897
4905
|
this.loading = true;
|
|
4898
|
-
var conversation_id = this.conversationService.getKey(this.botId);
|
|
4906
|
+
var conversation_id = this.conversationService.getKey(this.botId, false, this.eventId);
|
|
4899
4907
|
this.conversationId = conversation_id;
|
|
4900
4908
|
var url = this.environment.AGENTS_API + "/ConversationDocuments?conversationId=" + conversation_id + "&botId=" + this.botId;
|
|
4901
4909
|
var headers = new i1.HttpHeaders({
|
|
@@ -5356,7 +5364,7 @@
|
|
|
5356
5364
|
};
|
|
5357
5365
|
ChatDrawerComponent.prototype.startNewConversation = function () {
|
|
5358
5366
|
var _this = this;
|
|
5359
|
-
this.conversationKey = this.conversationService.getKey(this.botId, true);
|
|
5367
|
+
this.conversationKey = this.conversationService.getKey(this.botId, true, this.eventId);
|
|
5360
5368
|
this.chatLog = [this.chatLog[0]];
|
|
5361
5369
|
this.isChatingWithAi = false;
|
|
5362
5370
|
this.chatSocketInitialized = false;
|
|
@@ -5426,7 +5434,7 @@
|
|
|
5426
5434
|
ChatDrawerComponent.prototype.openVoiceModal = function () {
|
|
5427
5435
|
var _this = this;
|
|
5428
5436
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
5429
|
-
var conversationId = (_b = (_a = this.conversationKey) !== null && _a !== void 0 ? _a : this.conversationService.getKey(this.botId, false)) !== null && _b !== void 0 ? _b : '';
|
|
5437
|
+
var conversationId = (_b = (_a = this.conversationKey) !== null && _a !== void 0 ? _a : this.conversationService.getKey(this.botId, false, this.eventId)) !== null && _b !== void 0 ? _b : '';
|
|
5430
5438
|
this.voiceModalConversationId = conversationId;
|
|
5431
5439
|
this.setupVoiceTranscripts();
|
|
5432
5440
|
// Close existing overlay if any
|