@hivegpt/hiveai-angular 0.0.291 → 0.0.292

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.
@@ -532,13 +532,18 @@
532
532
  };
533
533
  ConversationService.prototype.getKey = function (botId, resetKey) {
534
534
  if (resetKey === void 0) { resetKey = false; }
535
- var storageKey = "conversationKey_" + botId;
536
- var value = localStorage.getItem(storageKey);
537
- if (!value || resetKey) {
538
- value = this.generateKey();
539
- localStorage.setItem(storageKey, value);
535
+ if (botId) {
536
+ var storageKey = "conversationKey_" + 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
+ else {
545
+ return '';
540
546
  }
541
- return value;
542
547
  };
543
548
  ConversationService.prototype.sendValidatedUserData = function (message) {
544
549
  //console.log('lgging messages', message, new Date());\
@@ -1005,13 +1010,15 @@
1005
1010
  this.loading = true;
1006
1011
  this.conversationKey = this.conversationService.getKey(this.botId, false);
1007
1012
  console.log("fetchChatHistory log");
1008
- var url = this.environment.BASE_URL + "/conversations/" + this.conversationKey;
1009
- var headers = new http.HttpHeaders({
1010
- accept: 'application/json',
1011
- });
1012
- return this.http
1013
- .get(url, { headers: headers })
1014
- .pipe(operators.catchError(this.handleError('fetchConversation')));
1013
+ if (this.conversationKey != '') {
1014
+ var url = this.environment.BASE_URL + "/conversations/" + this.conversationKey;
1015
+ var headers = new http.HttpHeaders({
1016
+ accept: 'application/json',
1017
+ });
1018
+ return this.http
1019
+ .get(url, { headers: headers })
1020
+ .pipe(operators.catchError(this.handleError('fetchConversation')));
1021
+ }
1015
1022
  };
1016
1023
  ChatDrawerComponent.prototype.handleError = function (operation, result) {
1017
1024
  if (operation === void 0) { operation = 'operation'; }