@hivegpt/hiveai-angular 0.0.267 → 0.0.270

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.
@@ -622,16 +622,18 @@
622
622
  };
623
623
  SocketService.prototype.registerUserSpecificHiveSocket = function (botId, conversation_id) {
624
624
  var _this = this;
625
- var commonNotification = "commonNotification";
625
+ var commonNotification = 'commonNotification';
626
+ var groupId = "Hive_AI_Notifs_" + botId + "_" + conversation_id;
627
+ // Remove any pre-existing listeners for commonNotification
626
628
  this.notificationSocket.removeAllListeners(commonNotification);
627
- console.log('Registering user-specific Hive socket with botId:' + botId);
628
- console.log('and conversation_id:' + conversation_id);
629
- this.notificationSocket.emit('joinData', {
630
- groupId: "Hive_AI_Notifs_" + botId + "_" + conversation_id,
631
- });
632
- this.notificationSocket
633
- .fromEvent(commonNotification)
634
- .subscribe(function (res) {
629
+ // Leave the existing group to ensure no previous socket data remains
630
+ this.notificationSocket.emit('leaveGroup', { groupId: groupId });
631
+ console.log('Registering user-specific Hive socket with botId:', botId);
632
+ console.log('and conversation_id:', conversation_id);
633
+ // Join the group again with updated botId and conversation_id
634
+ this.notificationSocket.emit('joinData', { groupId: groupId });
635
+ // Re-register for common notifications
636
+ this.notificationSocket.fromEvent(commonNotification).subscribe(function (res) {
635
637
  console.log('Received commonNotification:', res);
636
638
  _this.conversationService.sendValidatedUserData(res);
637
639
  }, function (error) {
@@ -657,7 +659,7 @@
657
659
  SocketService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SocketService_Factory() { return new SocketService(i0.ɵɵinject(ConversationService), i0.ɵɵinject(NotificationSocket)); }, token: SocketService, providedIn: "root" });
658
660
  SocketService.decorators = [
659
661
  { type: i0.Injectable, args: [{
660
- providedIn: 'root'
662
+ providedIn: 'root',
661
663
  },] }
662
664
  ];
663
665
  SocketService.ctorParameters = function () { return [
@@ -920,6 +922,7 @@
920
922
  if (this.eventSubscription) {
921
923
  this.eventSubscription.unsubscribe();
922
924
  }
925
+ this.socketService.disconnectSocketConnection();
923
926
  //this.socketService.close();
924
927
  };
925
928
  ChatDrawerComponent.prototype.changeTemperature = function (newTemperature) {