@hivegpt/hiveai-angular 0.0.231 → 0.0.232

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.
@@ -666,8 +666,7 @@
666
666
  ]; };
667
667
 
668
668
  var ChatDrawerComponent = /** @class */ (function () {
669
- function ChatDrawerComponent(cdr, http, sanitizer, elementRef, renderer, socketService, conversationService
670
- // private platform: Platform
669
+ function ChatDrawerComponent(cdr, http, sanitizer, elementRef, renderer, socketService, conversationService // private platform: Platform
671
670
  ) {
672
671
  var _this = this;
673
672
  this.cdr = cdr;
@@ -679,7 +678,7 @@
679
678
  this.conversationService = conversationService;
680
679
  this.bodyOverflowClass = 'body-overflow-hidden';
681
680
  this.isCollapsedTrue = false;
682
- this.copilotName = "HiveXGPT";
681
+ this.copilotName = 'HiveXGPT';
683
682
  this.feedbackEvent = new i0.EventEmitter();
684
683
  this.onCloseEvent = new i0.EventEmitter();
685
684
  this.openPage = new i0.EventEmitter();
@@ -688,10 +687,10 @@
688
687
  this.connectWithUser = new i0.EventEmitter();
689
688
  this.scheduleMeeting = new i0.EventEmitter();
690
689
  this.refreshToken = new i0.EventEmitter();
691
- this.autogenKey = "Autogen_eDJTtEU-NB0RtIpzq1w";
692
- this.addToMyAgendaAction = "add_to_my_agenda";
693
- this.myUpcomingSessionAction = "my_upcomming_session";
694
- this.connectOrFollowAction = "connect_or_follow";
690
+ this.autogenKey = 'Autogen_eDJTtEU-NB0RtIpzq1w';
691
+ this.addToMyAgendaAction = 'add_to_my_agenda';
692
+ this.myUpcomingSessionAction = 'my_upcomming_session';
693
+ this.connectOrFollowAction = 'connect_or_follow';
695
694
  this.aiResponse = '';
696
695
  this.chatLog = [];
697
696
  this.decoder = new TextDecoder();
@@ -816,7 +815,6 @@
816
815
  }, 200);
817
816
  };
818
817
  ChatDrawerComponent.prototype.initializeSocket = function () {
819
- ;
820
818
  var conversation_id = this.conversationService.getKey(this.botId);
821
819
  this.socketService.registerUserSpecificHiveSocket(this.botId, conversation_id);
822
820
  };
@@ -855,7 +853,8 @@
855
853
  if (answer) {
856
854
  _this.isChatingWithAi = false;
857
855
  console.log('Answer:', answer);
858
- currentChatMessage.message = _this.processMessageForDisplay(answer);
856
+ currentChatMessage.message =
857
+ _this.processMessageForDisplay(answer);
859
858
  _this.cdr.markForCheck();
860
859
  _this.scrollToBottom();
861
860
  }
@@ -885,8 +884,7 @@
885
884
  console.error('Error in fetching data from socket', err);
886
885
  });
887
886
  };
888
- ChatDrawerComponent.prototype.initializeSocketAndListen = function () {
889
- };
887
+ ChatDrawerComponent.prototype.initializeSocketAndListen = function () { };
890
888
  ChatDrawerComponent.prototype.handleEvent = function (data, type) {
891
889
  switch (type) {
892
890
  case 'webresult':
@@ -980,9 +978,11 @@
980
978
  this.conversationKey = this.conversationService.getKey(this.botId);
981
979
  var url = this.environment.BASE_URL + "/conversations/" + this.conversationKey;
982
980
  var headers = new http.HttpHeaders({
983
- 'accept': 'application/json'
981
+ accept: 'application/json',
984
982
  });
985
- return this.http.get(url, { headers: headers }).pipe(operators.catchError(this.handleError('fetchConversation')));
983
+ return this.http
984
+ .get(url, { headers: headers })
985
+ .pipe(operators.catchError(this.handleError('fetchConversation')));
986
986
  };
987
987
  ChatDrawerComponent.prototype.handleError = function (operation, result) {
988
988
  if (operation === void 0) { operation = 'operation'; }
@@ -1022,16 +1022,16 @@
1022
1022
  });
1023
1023
  if (chats && ((_a = chats === null || chats === void 0 ? void 0 : chats.Messages) === null || _a === void 0 ? void 0 : _a.length)) {
1024
1024
  chats === null || chats === void 0 ? void 0 : chats.Messages.forEach(function (chat) {
1025
- if (chat.Type == "user") {
1025
+ if (chat.Type == 'user') {
1026
1026
  _this.chatLog.push({
1027
1027
  type: 'user',
1028
1028
  message: _this.processMessageForDisplay(chat.Text),
1029
1029
  time: formatTimeStamps(_this.timezone, chat.InsertTimestamp),
1030
1030
  copied: false,
1031
- isCollapsedTrue: false
1031
+ isCollapsedTrue: false,
1032
1032
  });
1033
1033
  }
1034
- if (chat.Type == "ai") {
1034
+ if (chat.Type == 'ai') {
1035
1035
  var sourcesList = chat.WebLinks || [];
1036
1036
  var displayedSources = chat.WebLinks.slice(0, 3); // First 3 cards
1037
1037
  var remainingSources = chat.WebLinks.slice(3); // Remaining items
@@ -1046,7 +1046,7 @@
1046
1046
  remainingSources: remainingSources,
1047
1047
  time: formatTimeStamps(_this.timezone, chat.InsertTimestamp),
1048
1048
  copied: false,
1049
- isCollapsedTrue: false
1049
+ isCollapsedTrue: false,
1050
1050
  });
1051
1051
  _this.showFeedBackIconsIndex = _this.chatLog.length - 1;
1052
1052
  }
@@ -1127,15 +1127,14 @@
1127
1127
  message: this.processMessageForDisplay(this.input),
1128
1128
  time: formatNow(this.timezone),
1129
1129
  copied: false,
1130
- isCollapsedTrue: false
1130
+ isCollapsedTrue: false,
1131
1131
  });
1132
1132
  try {
1133
1133
  var textarea = this.myInput.nativeElement;
1134
1134
  textarea.style.height = 'hidden'; // Reset the height
1135
1135
  textarea.style.height = "62px";
1136
1136
  }
1137
- catch (error) {
1138
- }
1137
+ catch (error) { }
1139
1138
  this.cdr.markForCheck();
1140
1139
  this.aiResponse = '';
1141
1140
  this.isChatingWithAi = true;
@@ -1145,7 +1144,7 @@
1145
1144
  method: 'POST',
1146
1145
  headers: {
1147
1146
  'Content-Type': 'application/json',
1148
- 'Authorization': 'Bearer ' + this.s27Token,
1147
+ Authorization: 'Bearer ' + this.s27Token,
1149
1148
  'x-api-key': this.apiKey,
1150
1149
  },
1151
1150
  body: JSON.stringify({
@@ -1194,7 +1193,7 @@
1194
1193
  message: this.processMessageForDisplay(inputMsg),
1195
1194
  time: formatNow(this.timezone),
1196
1195
  copied: false,
1197
- isCollapsedTrue: false
1196
+ isCollapsedTrue: false,
1198
1197
  });
1199
1198
  this.cdr.markForCheck();
1200
1199
  this.aiResponse = '';
@@ -1205,7 +1204,7 @@
1205
1204
  method: 'POST',
1206
1205
  headers: {
1207
1206
  'Content-Type': 'application/json',
1208
- 'Authorization': 'Bearer ' + this.s27Token,
1207
+ Authorization: 'Bearer ' + this.s27Token,
1209
1208
  'x-api-key': this.apiKey,
1210
1209
  },
1211
1210
  body: JSON.stringify({
@@ -1287,7 +1286,7 @@
1287
1286
  if (allSuggestions === null || allSuggestions === void 0 ? void 0 : allSuggestions.length) {
1288
1287
  _this.chatLog.push({
1289
1288
  type: 'suggestions',
1290
- suggestions: allSuggestions
1289
+ suggestions: allSuggestions,
1291
1290
  });
1292
1291
  }
1293
1292
  controller.close();
@@ -1306,8 +1305,8 @@
1306
1305
  var suggestionsMatch = _this.aiResponse.match(/<sug>(.*?)<\/sug>/g);
1307
1306
  if (suggestionsMatch) {
1308
1307
  suggestionsMatch.forEach(function (match) {
1309
- _this.aiResponse = _this.aiResponse.replace(match, "");
1310
- allSuggestions.push(match === null || match === void 0 ? void 0 : match.replace(/<\/?sug>/g, ""));
1308
+ _this.aiResponse = _this.aiResponse.replace(match, '');
1309
+ allSuggestions.push(match === null || match === void 0 ? void 0 : match.replace(/<\/?sug>/g, ''));
1311
1310
  });
1312
1311
  }
1313
1312
  lastItem.message = _this.aiResponse;
@@ -1329,7 +1328,9 @@
1329
1328
  }
1330
1329
  console.log('parsing json done');
1331
1330
  if (aiFormattedData && ((_a = aiFormattedData === null || aiFormattedData === void 0 ? void 0 : aiFormattedData.section_id) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1332
- if (aiFormattedData.section_id == 'company_search' || aiFormattedData.section_id == 'user_search' || aiFormattedData.section_id == 'industry_company_search') {
1331
+ if (aiFormattedData.section_id == 'company_search' ||
1332
+ aiFormattedData.section_id == 'user_search' ||
1333
+ aiFormattedData.section_id == 'industry_company_search') {
1333
1334
  _this.fetchMyConnections().subscribe();
1334
1335
  _this.fetchPendingRequests().subscribe();
1335
1336
  }
@@ -1341,48 +1342,50 @@
1341
1342
  if ((speakerIds === null || speakerIds === void 0 ? void 0 : speakerIds.length) > 0)
1342
1343
  _this.getSpeakersByStaffIds(speakerIds);
1343
1344
  }
1344
- if (aiFormattedData.section_id == _this.addToMyAgendaAction && ((_c = aiFormattedData.content) === null || _c === void 0 ? void 0 : _c.length) > 0) {
1345
+ if (aiFormattedData.section_id == _this.addToMyAgendaAction &&
1346
+ ((_c = aiFormattedData.content) === null || _c === void 0 ? void 0 : _c.length) > 0) {
1345
1347
  _this.openPage.next({
1346
1348
  sectionId: aiFormattedData.section_id,
1347
- sessionIds: aiFormattedData.content
1349
+ sessionIds: aiFormattedData.content,
1348
1350
  });
1349
1351
  }
1350
1352
  if (aiFormattedData.section_id == _this.connectOrFollowAction) {
1351
1353
  var usersLen = (_d = aiFormattedData.content) === null || _d === void 0 ? void 0 : _d.length;
1352
1354
  if (usersLen > 1) {
1353
1355
  _this.openPage.next({
1354
- sectionId: "open_networking_drawer",
1355
- search: aiFormattedData.content
1356
+ sectionId: 'open_networking_drawer',
1357
+ search: aiFormattedData.content,
1356
1358
  });
1357
1359
  }
1358
1360
  else if (usersLen == 1) {
1359
1361
  _this.openPage.next({
1360
1362
  sectionId: aiFormattedData.section_id,
1361
- connetUserIds: [aiFormattedData.content[0].userId]
1363
+ connetUserIds: [aiFormattedData.content[0].userId],
1362
1364
  });
1363
1365
  }
1364
1366
  }
1365
- if (aiFormattedData.is_open_page == "true") {
1367
+ if (aiFormattedData.is_open_page == 'true') {
1366
1368
  _this.openPage.next({
1367
1369
  sectionId: aiFormattedData.section_id,
1368
- search: aiFormattedData.content
1370
+ search: aiFormattedData.content,
1369
1371
  });
1370
1372
  if (_this.isMobileBrowser()) {
1371
- aiFormattedData.message += "\n\n" + '<a id="closeBotNow">Click Here</a> to see results.';
1373
+ aiFormattedData.message +=
1374
+ '\n\n' + '<a id="closeBotNow">Click Here</a> to see results.';
1372
1375
  }
1373
1376
  }
1374
1377
  _this.chatLog.push({
1375
1378
  type: 'ai',
1376
1379
  message: aiFormattedData.message,
1377
1380
  action: aiFormattedData,
1378
- time: formatNow(_this.timezone)
1381
+ time: formatNow(_this.timezone),
1379
1382
  });
1380
1383
  if (_this.isMobileBrowser()) {
1381
1384
  setTimeout(function () {
1382
1385
  _this.addCloseBotClickEvent();
1383
1386
  }, 500);
1384
1387
  }
1385
- _this.aiResponse = "";
1388
+ _this.aiResponse = '';
1386
1389
  }
1387
1390
  else {
1388
1391
  _this.chatLog.push({
@@ -1468,6 +1471,8 @@
1468
1471
  var _this = this;
1469
1472
  // Copy the message to the clipboard
1470
1473
  var contentToCopy = this.chatLog[index].message;
1474
+ console.log('contentToCopy');
1475
+ console.log(contentToCopy);
1471
1476
  navigator.clipboard.writeText(contentToCopy).then(function () {
1472
1477
  // Indicate that the message was copied
1473
1478
  _this.chatLog[index].copied = true;
@@ -1490,7 +1495,7 @@
1490
1495
  }, 5);
1491
1496
  };
1492
1497
  ChatDrawerComponent.prototype.handleAction = function (action) {
1493
- console.info("incoming action from the chatbot AI");
1498
+ console.info('incoming action from the chatbot AI');
1494
1499
  console.info(action);
1495
1500
  if (action === null || action === void 0 ? void 0 : action.content) {
1496
1501
  }
@@ -1533,7 +1538,7 @@
1533
1538
  method: 'POST',
1534
1539
  headers: {
1535
1540
  'Content-Type': 'application/json',
1536
- 'Authorization': "Bearer " + "your_token_here",
1541
+ Authorization: 'Bearer ' + 'your_token_here',
1537
1542
  },
1538
1543
  body: JSON.stringify(ids),
1539
1544
  })
@@ -1561,7 +1566,7 @@
1561
1566
  ChatDrawerComponent.prototype.performSessionAction = function (sessionId, action) {
1562
1567
  this.sessionActions.next({
1563
1568
  sessionId: sessionId,
1564
- action: action
1569
+ action: action,
1565
1570
  });
1566
1571
  };
1567
1572
  ChatDrawerComponent.prototype.addCloseBotClickEvent = function () {
@@ -1580,7 +1585,7 @@
1580
1585
  var _this = this;
1581
1586
  this.connectWithUser.emit({
1582
1587
  connect: !this.canDisconnect(userId),
1583
- userId: userId
1588
+ userId: userId,
1584
1589
  });
1585
1590
  setTimeout(function () {
1586
1591
  _this.fetchMyConnections().subscribe(function (res) {
@@ -1595,7 +1600,8 @@
1595
1600
  this.scheduleMeeting.emit(user);
1596
1601
  };
1597
1602
  ChatDrawerComponent.prototype.canConnect = function (userId) {
1598
- return !(this.canDisconnect(userId) || this.pendingRequests.find(function (a) { return a == userId; }));
1603
+ return !(this.canDisconnect(userId) ||
1604
+ this.pendingRequests.find(function (a) { return a == userId; }));
1599
1605
  };
1600
1606
  ChatDrawerComponent.prototype.canDisconnect = function (userId) {
1601
1607
  return this.myConnections.find(function (conn) { return conn.userId == userId; });
@@ -1604,7 +1610,7 @@
1604
1610
  var _this = this;
1605
1611
  var headers = new http.HttpHeaders({
1606
1612
  'Content-Type': 'application/json',
1607
- 'apiKey': this.autogenKey
1613
+ apiKey: this.autogenKey,
1608
1614
  });
1609
1615
  return this.http
1610
1616
  .get(this.environment.USERS_API + "/events/" + this.eventId + "/connection-requests/autogen/pending-sent-requests?userId=" + this.userId, { headers: headers })
@@ -1621,7 +1627,7 @@
1621
1627
  var _this = this;
1622
1628
  var headers = new http.HttpHeaders({
1623
1629
  'Content-Type': 'application/json',
1624
- 'apiKey': this.autogenKey
1630
+ apiKey: this.autogenKey,
1625
1631
  });
1626
1632
  return this.http
1627
1633
  .get(this.environment.USERS_API + "/events/" + this.eventId + "/users-connections/autogen?userId=" + this.userId, { headers: headers })
@@ -1640,7 +1646,7 @@
1640
1646
  };
1641
1647
  ChatDrawerComponent.prototype.onSelectAll = function (event) {
1642
1648
  var _a;
1643
- (_a = this.agents) === null || _a === void 0 ? void 0 : _a.forEach(function (agent) { return agent.selected = false; });
1649
+ (_a = this.agents) === null || _a === void 0 ? void 0 : _a.forEach(function (agent) { return (agent.selected = false); });
1644
1650
  this.cdr.detectChanges();
1645
1651
  };
1646
1652
  ChatDrawerComponent.prototype.onAgentChange = function (agent) {
@@ -1664,7 +1670,9 @@
1664
1670
  return 'All Agents';
1665
1671
  }
1666
1672
  else {
1667
- return (selectedAgents === null || selectedAgents === void 0 ? void 0 : selectedAgents.length) > 1 ? (selectedAgents === null || selectedAgents === void 0 ? void 0 : selectedAgents.length) + " Agents Selected" : (selectedAgents === null || selectedAgents === void 0 ? void 0 : selectedAgents.length) + " Agent Selected";
1673
+ return (selectedAgents === null || selectedAgents === void 0 ? void 0 : selectedAgents.length) > 1
1674
+ ? (selectedAgents === null || selectedAgents === void 0 ? void 0 : selectedAgents.length) + " Agents Selected"
1675
+ : (selectedAgents === null || selectedAgents === void 0 ? void 0 : selectedAgents.length) + " Agent Selected";
1668
1676
  }
1669
1677
  };
1670
1678
  ChatDrawerComponent.prototype.fetchAgents_http = function () {
@@ -1672,7 +1680,7 @@
1672
1680
  this.loading = true;
1673
1681
  var url = this.environment.AGENTS_API + "/CoPilot/" + this.botId + "/active-agents";
1674
1682
  var headers = new http.HttpHeaders({
1675
- 'Content-Type': 'application/json'
1683
+ 'Content-Type': 'application/json',
1676
1684
  });
1677
1685
  return this.http.post(url, {}, { headers: headers }).pipe(operators.switchMap(function (res) {
1678
1686
  if (res) {
@@ -1686,8 +1694,7 @@
1686
1694
  }));
1687
1695
  };
1688
1696
  ChatDrawerComponent.prototype.fetchAgents = function () {
1689
- this.fetchAgents_http()
1690
- .subscribe();
1697
+ this.fetchAgents_http().subscribe();
1691
1698
  };
1692
1699
  // events/${eventId}/users-connections
1693
1700
  ChatDrawerComponent.prototype.processMessageForDisplay = function (markdown) {