@hivegpt/hiveai-angular 0.0.385 → 0.0.386

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.
@@ -550,7 +550,7 @@ class ChatDrawerComponent {
550
550
  this.recognizedText = '';
551
551
  this.authorizationToken = '';
552
552
  this.region = 'westeurope'; // Set your Azure region here
553
- this.domainAuthorityValue = "prod-lite";
553
+ this.domainAuthorityValue = 'prod-lite';
554
554
  this.isChatingWithAi = false;
555
555
  this.readAllChunks = (stream) => {
556
556
  const reader = stream.getReader();
@@ -682,7 +682,9 @@ class ChatDrawerComponent {
682
682
  // this.fetchEditorContent();
683
683
  this.cdr.markForCheck();
684
684
  // this.initializeSocket();
685
- this.botService.fetchSpeechAuthorizationToken(this.botId, this.apiKey, this.domainAuthorityValue).subscribe((token) => {
685
+ this.botService
686
+ .fetchSpeechAuthorizationToken(this.botId, this.apiKey, this.domainAuthorityValue)
687
+ .subscribe((token) => {
686
688
  this.authorizationToken = token;
687
689
  this.initializeSpeechRecognizer(token);
688
690
  });
@@ -722,15 +724,18 @@ class ChatDrawerComponent {
722
724
  this.currentWorkflowAction = action_name;
723
725
  const actionIndex = this.workflowExecutionDetails.Actions.findIndex((a) => a.Name == current_action_name);
724
726
  if (actionIndex !== -1) {
725
- this.workflowExecutionDetails.Actions[actionIndex]['Output'] = output;
727
+ this.workflowExecutionDetails.Actions[actionIndex]['Output'] =
728
+ output;
726
729
  this.workflowExecutionDetails.Actions[actionIndex]['InsertTimeStamp'] = formatTimeStamps(this.timezone, time_stamp);
727
730
  }
728
731
  else {
729
732
  console.error(`Action with name ${action_name} not found`);
730
733
  }
731
- this.currentWorkflowExecutionDetails = this.workflowExecutionDetails;
734
+ this.currentWorkflowExecutionDetails =
735
+ this.workflowExecutionDetails;
732
736
  if (this.currentWorkflowActionProgress == 100) {
733
- this.chatLog[this.chatLog.length - 1]['WorkflowExecutionId'] = workflow_execution_id;
737
+ this.chatLog[this.chatLog.length - 1]['WorkflowExecutionId'] =
738
+ workflow_execution_id;
734
739
  this.isChatingWithAi = false;
735
740
  this.executingWorkflow = false;
736
741
  }
@@ -772,7 +777,8 @@ class ChatDrawerComponent {
772
777
  if (answer) {
773
778
  this.isChatingWithAi = false;
774
779
  console.log('Answer:', answer);
775
- currentChatMessage.message = this.processMessageForDisplay(answer);
780
+ currentChatMessage.message =
781
+ this.processMessageForDisplay(answer);
776
782
  this.cdr.detectChanges();
777
783
  this.scrollToBottom();
778
784
  }
@@ -860,7 +866,7 @@ class ChatDrawerComponent {
860
866
  'Content-Type': 'application/json',
861
867
  'x-api-key': this.apiKey,
862
868
  'hive-bot-id': this.botId,
863
- 'domain-authority': this.domainAuthorityValue
869
+ 'domain-authority': this.domainAuthorityValue,
864
870
  });
865
871
  const url = `${this.environment.BASE_URL}/bot/clear-history/${this.botId}/${this.userId}`;
866
872
  return this.http.post(url, { headers }).pipe(switchMap((res) => {
@@ -877,7 +883,7 @@ class ChatDrawerComponent {
877
883
  const headers = new HttpHeaders({
878
884
  'x-api-key': this.apiKey,
879
885
  'hive-bot-id': this.botId,
880
- 'domain-authority': this.domainAuthorityValue
886
+ 'domain-authority': this.domainAuthorityValue,
881
887
  });
882
888
  const url = `${this.environment.BASE_URL}/bots?bot_id=${this.botId}`;
883
889
  return this.http.get(url, { headers }).pipe(switchMap((res) => {
@@ -910,7 +916,7 @@ class ChatDrawerComponent {
910
916
  accept: 'application/json',
911
917
  'x-api-key': this.apiKey,
912
918
  'hive-bot-id': this.botId,
913
- 'domain-authority': this.domainAuthorityValue
919
+ 'domain-authority': this.domainAuthorityValue,
914
920
  });
915
921
  return this.http
916
922
  .get(url, { headers })
@@ -959,7 +965,7 @@ class ChatDrawerComponent {
959
965
  copied: false,
960
966
  isCollapsedTrue: false,
961
967
  WorkflowExecutionId: chat.WorkflowExecutionId,
962
- _id: chat._id
968
+ _id: chat._id,
963
969
  });
964
970
  }
965
971
  if (chat.Type == 'ai') {
@@ -978,7 +984,7 @@ class ChatDrawerComponent {
978
984
  time: formatTimeStamps(this.timezone, chat.InsertTimestamp),
979
985
  copied: false,
980
986
  isCollapsedTrue: false,
981
- _id: chat._id
987
+ _id: chat._id,
982
988
  });
983
989
  this.showFeedBackIconsIndex = this.chatLog.length - 1;
984
990
  }
@@ -1101,7 +1107,7 @@ class ChatDrawerComponent {
1101
1107
  headers: {
1102
1108
  'x-api-key': this.apiKey,
1103
1109
  'hive-bot-id': this.botId,
1104
- 'domain-authority': this.domainAuthorityValue
1110
+ 'domain-authority': this.domainAuthorityValue,
1105
1111
  },
1106
1112
  })
1107
1113
  .pipe(catchError((error) => {
@@ -1265,9 +1271,9 @@ class ChatDrawerComponent {
1265
1271
  method: 'POST',
1266
1272
  headers: {
1267
1273
  'Content-Type': 'application/json',
1268
- 'apiKey': 'Conversation_WIz/qAm+EEmfOkFaUA/weA==',
1274
+ apiKey: 'Conversation_WIz/qAm+EEmfOkFaUA/weA==',
1269
1275
  'hive-bot-id': this.botId,
1270
- 'domain-authority': this.domainAuthorityValue
1276
+ 'domain-authority': this.domainAuthorityValue,
1271
1277
  },
1272
1278
  body: JSON.stringify({ messageId: message._id, isHelpful: flag }),
1273
1279
  }).then(() => {
@@ -1437,7 +1443,8 @@ class ChatDrawerComponent {
1437
1443
  scrollToBottom() {
1438
1444
  let counter = 0;
1439
1445
  const interval = setInterval(() => {
1440
- this.chatMain.nativeElement.scrollTop = this.chatMain.nativeElement.scrollHeight;
1446
+ this.chatMain.nativeElement.scrollTop =
1447
+ this.chatMain.nativeElement.scrollHeight;
1441
1448
  if (counter++ > 5)
1442
1449
  clearInterval(interval);
1443
1450
  }, 5);
@@ -1653,7 +1660,7 @@ class ChatDrawerComponent {
1653
1660
  const headers = new HttpHeaders({
1654
1661
  'Content-Type': 'application/json',
1655
1662
  apiKey: 'WIz/qAm+EEmfOkFaUA/weA==',
1656
- 'domain-authority': this.domainAuthorityValue
1663
+ 'domain-authority': this.domainAuthorityValue,
1657
1664
  });
1658
1665
  return this.http.get(url, { headers }).pipe(switchMap((res) => {
1659
1666
  if (res) {
@@ -1854,8 +1861,7 @@ class ChatDrawerComponent {
1854
1861
  event.preventDefault();
1855
1862
  }
1856
1863
  }
1857
- catch (error) {
1858
- }
1864
+ catch (error) { }
1859
1865
  const textarea = event.target;
1860
1866
  textarea.style.height = 'auto'; // Reset the height
1861
1867
  textarea.style.height = `${textarea.scrollHeight}px`; // Adjust height to match content
@@ -1909,8 +1915,10 @@ class ChatDrawerComponent {
1909
1915
  var input = this.prepareHtml(this.generateMarkdown(this.selectedWorkflow.Name, this.workflowForm.value));
1910
1916
  // update last two chatLog entries, set showWorkflowExecutionLoader = false
1911
1917
  try {
1912
- this.chatLog[this.chatLog.length - 1]['showWorkflowExecutionLoader'] = false;
1913
- this.chatLog[this.chatLog.length - 2]['showWorkflowExecutionLoader'] = false;
1918
+ this.chatLog[this.chatLog.length - 1]['showWorkflowExecutionLoader'] =
1919
+ false;
1920
+ this.chatLog[this.chatLog.length - 2]['showWorkflowExecutionLoader'] =
1921
+ false;
1914
1922
  }
1915
1923
  catch (error) { }
1916
1924
  this.chatLog.push({
@@ -1952,23 +1960,27 @@ class ChatDrawerComponent {
1952
1960
  agents: (_a = agents === null || agents === void 0 ? void 0 : agents.filter((p) => p.selected).map((p) => p.id)) !== null && _a !== void 0 ? _a : [],
1953
1961
  conversation_id: conversationId,
1954
1962
  first_name: this.firstName,
1955
- last_name: this.lastName
1963
+ last_name: this.lastName,
1956
1964
  };
1957
1965
  if (workflowId) {
1958
1966
  body['workflow_id'] = workflowId;
1959
1967
  body['workflow_inputs'] = workflow_inputs;
1960
1968
  }
1969
+ const headers = {
1970
+ 'Content-Type': 'application/json',
1971
+ Authorization: 'Bearer ' + this.s27Token,
1972
+ 'x-api-key': this.apiKey,
1973
+ 'hive-bot-id': this.botId,
1974
+ 'domain-authority': this.domainAuthorityValue,
1975
+ event_url: this.eventUrl,
1976
+ event_token: this.eventToken,
1977
+ };
1978
+ if (this.workspaceToken) {
1979
+ headers['workspace_token'] = this.workspaceToken;
1980
+ }
1961
1981
  fetch(url, {
1962
1982
  method: 'POST',
1963
- headers: {
1964
- 'Content-Type': 'application/json',
1965
- Authorization: 'Bearer ' + this.s27Token,
1966
- 'x-api-key': this.apiKey,
1967
- 'hive-bot-id': this.botId,
1968
- 'domain-authority': this.domainAuthorityValue,
1969
- 'event_url': this.eventUrl,
1970
- 'event_token': this.eventToken
1971
- },
1983
+ headers: headers,
1972
1984
  body: JSON.stringify(body),
1973
1985
  })
1974
1986
  .then((response) => {
@@ -2025,8 +2037,7 @@ class ChatDrawerComponent {
2025
2037
  'hive-bot-id': this.botId,
2026
2038
  'domain-authority': this.domainAuthorityValue,
2027
2039
  });
2028
- this.http.post(url, body, { headers })
2029
- .subscribe({
2040
+ this.http.post(url, body, { headers }).subscribe({
2030
2041
  next: (data) => {
2031
2042
  console.log(data);
2032
2043
  // Additional response handling if needed
@@ -2136,7 +2147,8 @@ class ChatDrawerComponent {
2136
2147
  this.recognizer.stopContinuousRecognitionAsync();
2137
2148
  }
2138
2149
  checkForCop29BotId() {
2139
- return this.botId == '66fa3f276c5d71e2717bfea8' || this.botId == '671633545652dd78efec848d';
2150
+ return (this.botId == '66fa3f276c5d71e2717bfea8' ||
2151
+ this.botId == '671633545652dd78efec848d');
2140
2152
  }
2141
2153
  getLatestTime(time) {
2142
2154
  if (time) {
@@ -2195,6 +2207,7 @@ ChatDrawerComponent.propDecorators = {
2195
2207
  eventId: [{ type: Input }],
2196
2208
  eventUrl: [{ type: Input }],
2197
2209
  eventToken: [{ type: Input }],
2210
+ workspaceToken: [{ type: Input }],
2198
2211
  s27Token: [{ type: Input }],
2199
2212
  eventName: [{ type: Input }],
2200
2213
  botIcon: [{ type: Input }],