@hivegpt/hiveai-angular 0.0.354 → 0.0.355
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 -7
- 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 +5 -2
- package/esm2015/lib/components/conversation.service.js +17 -8
- package/fesm2015/hivegpt-hiveai-angular.js +20 -8
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/hivegpt-hiveai-angular.metadata.json +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts +1 -0
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/lib/components/conversation.service.d.ts +4 -2
- package/lib/components/conversation.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -520,8 +520,9 @@
|
|
|
520
520
|
|
|
521
521
|
var ConversationService = /** @class */ (function () {
|
|
522
522
|
function ConversationService() {
|
|
523
|
-
this.
|
|
524
|
-
this.
|
|
523
|
+
this.conversationStorageKeyPrefix = 'conversationKey_';
|
|
524
|
+
this.sessionStorageKeyPrefix = 'sessionKey_';
|
|
525
|
+
this.userSpecificNotification = new rxjs.Subject();
|
|
525
526
|
}
|
|
526
527
|
ConversationService.prototype.generateKey = function () {
|
|
527
528
|
var timestamp = Math.floor(new Date().getTime() / 1000).toString(16);
|
|
@@ -532,7 +533,17 @@
|
|
|
532
533
|
};
|
|
533
534
|
ConversationService.prototype.getKey = function (botId, resetKey) {
|
|
534
535
|
if (resetKey === void 0) { resetKey = false; }
|
|
535
|
-
var storageKey = "
|
|
536
|
+
var storageKey = "" + this.conversationStorageKeyPrefix + botId;
|
|
537
|
+
var value = localStorage.getItem(storageKey);
|
|
538
|
+
if (!value || resetKey) {
|
|
539
|
+
value = this.generateKey();
|
|
540
|
+
localStorage.setItem(storageKey, value);
|
|
541
|
+
}
|
|
542
|
+
return value;
|
|
543
|
+
};
|
|
544
|
+
ConversationService.prototype.getSessionKey = function (sessionId, resetKey) {
|
|
545
|
+
if (resetKey === void 0) { resetKey = false; }
|
|
546
|
+
var storageKey = "" + this.sessionStorageKeyPrefix + sessionId;
|
|
536
547
|
var value = localStorage.getItem(storageKey);
|
|
537
548
|
if (!value || resetKey) {
|
|
538
549
|
value = this.generateKey();
|
|
@@ -541,11 +552,10 @@
|
|
|
541
552
|
return value;
|
|
542
553
|
};
|
|
543
554
|
ConversationService.prototype.sendValidatedUserData = function (message) {
|
|
544
|
-
|
|
545
|
-
this.userSepecificNotification.next(message);
|
|
555
|
+
this.userSpecificNotification.next(message);
|
|
546
556
|
};
|
|
547
557
|
ConversationService.prototype.getUserSpecificNotification = function () {
|
|
548
|
-
return this.
|
|
558
|
+
return this.userSpecificNotification.asObservable();
|
|
549
559
|
};
|
|
550
560
|
return ConversationService;
|
|
551
561
|
}());
|
|
@@ -755,6 +765,7 @@
|
|
|
755
765
|
this.showFeedBackIconsIndex = null;
|
|
756
766
|
this.temperature = 1;
|
|
757
767
|
this.speakers = [];
|
|
768
|
+
this.conSessionKey = '';
|
|
758
769
|
this.currentWorkflowActionProgress = 0;
|
|
759
770
|
this.currentWorkflowAction = '';
|
|
760
771
|
this.recognizedText = '';
|
|
@@ -1106,7 +1117,8 @@
|
|
|
1106
1117
|
ChatDrawerComponent.prototype.fetchChatHistory = function () {
|
|
1107
1118
|
this.loading = true;
|
|
1108
1119
|
this.conversationKey = this.conversationService.getKey(this.botId, false);
|
|
1109
|
-
|
|
1120
|
+
this.conSessionKey = this.conversationService.getSessionKey(this.botId, false);
|
|
1121
|
+
var url = this.environment.BASE_URL + "/conversations/" + this.conversationKey + "?session_id=" + this.conSessionKey;
|
|
1110
1122
|
var headers = new i1.HttpHeaders({
|
|
1111
1123
|
accept: 'application/json',
|
|
1112
1124
|
'x-api-key': this.apiKey,
|
|
@@ -2169,6 +2181,7 @@
|
|
|
2169
2181
|
user_id: this.userId,
|
|
2170
2182
|
bot_id: this.botId,
|
|
2171
2183
|
message_id: this.conversationService.generateKey(),
|
|
2184
|
+
session_id: this.conSessionKey,
|
|
2172
2185
|
agents: (_a = agents === null || agents === void 0 ? void 0 : agents.filter(function (p) { return p.selected; }).map(function (p) { return p.id; })) !== null && _a !== void 0 ? _a : [],
|
|
2173
2186
|
conversation_id: conversationId,
|
|
2174
2187
|
first_name: this.firstName,
|