@hivegpt/hiveai-angular 0.0.143 → 0.0.145
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 +98 -18
- 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/environments/environment.js +2 -2
- package/esm2015/hivegpt-hiveai-angular.js +5 -4
- package/esm2015/lib/components/chat-drawer/chat-drawer.component.js +49 -11
- package/esm2015/lib/components/socket-service.service.js +42 -0
- package/fesm2015/hivegpt-hiveai-angular.js +88 -13
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/hivegpt-hiveai-angular.d.ts +4 -3
- package/hivegpt-hiveai-angular.d.ts.map +1 -1
- package/hivegpt-hiveai-angular.metadata.json +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts +7 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/lib/components/socket-service.service.d.ts +11 -0
- package/lib/components/socket-service.service.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('@angular/platform-browser'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('@angular/forms'), require('@angular/material/icon'), require('@angular/material/sidenav')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@hivegpt/hiveai-angular', ['exports', '@angular/common/http', '@angular/core', '@angular/platform-browser', 'rxjs', 'rxjs/operators', '@angular/common', '@angular/forms', '@angular/material/icon', '@angular/material/sidenav'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.hivegpt = global.hivegpt || {}, global.hivegpt['hiveai-angular'] = {}), global.ng.common.http, global.ng.core, global.ng.platformBrowser, global.rxjs, global.rxjs.operators, global.ng.common, global.ng.forms, global.ng.material.icon, global.ng.material.sidenav));
|
|
5
|
-
}(this, (function (exports, http, i0, platformBrowser, rxjs, operators, common, forms, icon, sidenav) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('@angular/platform-browser'), require('rxjs'), require('rxjs/operators'), require('rxjs/webSocket'), require('@angular/common'), require('@angular/forms'), require('@angular/material/icon'), require('@angular/material/sidenav')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@hivegpt/hiveai-angular', ['exports', '@angular/common/http', '@angular/core', '@angular/platform-browser', 'rxjs', 'rxjs/operators', 'rxjs/webSocket', '@angular/common', '@angular/forms', '@angular/material/icon', '@angular/material/sidenav'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.hivegpt = global.hivegpt || {}, global.hivegpt['hiveai-angular'] = {}), global.ng.common.http, global.ng.core, global.ng.platformBrowser, global.rxjs, global.rxjs.operators, global.rxjs.webSocket, global.ng.common, global.ng.forms, global.ng.material.icon, global.ng.material.sidenav));
|
|
5
|
+
}(this, (function (exports, http, i0, platformBrowser, rxjs, operators, webSocket, common, forms, icon, sidenav) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/******************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -508,7 +508,7 @@
|
|
|
508
508
|
BASE_URL: 'https://agent-api.hivegpt.ai',
|
|
509
509
|
AGENTS_API: 'https://hive-ai.social27.com/api',
|
|
510
510
|
API_KEY: 'b621eb3f-0bd2-41d5-a48c-a8f8ab7d38f8',
|
|
511
|
-
SocketUrl: 'https://notif-v2-api.social27.com/api/'
|
|
511
|
+
SocketUrl: 'https://notif-v2-api.social27.com/api/notifications'
|
|
512
512
|
};
|
|
513
513
|
var dev_environment = {
|
|
514
514
|
USERS_API: 'https://pre-user.social27.com/api',
|
|
@@ -552,8 +552,48 @@
|
|
|
552
552
|
];
|
|
553
553
|
ConversationService.ctorParameters = function () { return []; };
|
|
554
554
|
|
|
555
|
+
var SocketService = /** @class */ (function () {
|
|
556
|
+
function SocketService() {
|
|
557
|
+
this.connect();
|
|
558
|
+
}
|
|
559
|
+
SocketService.prototype.connect = function () {
|
|
560
|
+
var _this = this;
|
|
561
|
+
var url = prod_environment;
|
|
562
|
+
this.socket$ = webSocket.webSocket('ws://' + url.SocketUrl);
|
|
563
|
+
this.socket$.subscribe(function (message) { return _this.onMessage(message); }, function (err) { return console.error('WebSocket error', err); }, function () { return console.warn('WebSocket closed'); });
|
|
564
|
+
};
|
|
565
|
+
SocketService.prototype.onMessage = function (message) {
|
|
566
|
+
console.log('Received message:', message);
|
|
567
|
+
// Handle incoming messages
|
|
568
|
+
};
|
|
569
|
+
SocketService.prototype.sendMessage = function (message) {
|
|
570
|
+
this.socket$.next(message);
|
|
571
|
+
};
|
|
572
|
+
SocketService.prototype.close = function () {
|
|
573
|
+
this.socket$.complete();
|
|
574
|
+
};
|
|
575
|
+
SocketService.prototype.onEvent = function (eventName) {
|
|
576
|
+
var _this = this;
|
|
577
|
+
return new rxjs.Observable(function (observer) {
|
|
578
|
+
_this.socket$.subscribe(function (message) {
|
|
579
|
+
if (message.event === eventName) {
|
|
580
|
+
observer.next(message.data);
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
});
|
|
584
|
+
};
|
|
585
|
+
return SocketService;
|
|
586
|
+
}());
|
|
587
|
+
SocketService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SocketService_Factory() { return new SocketService(); }, token: SocketService, providedIn: "root" });
|
|
588
|
+
SocketService.decorators = [
|
|
589
|
+
{ type: i0.Injectable, args: [{
|
|
590
|
+
providedIn: 'root'
|
|
591
|
+
},] }
|
|
592
|
+
];
|
|
593
|
+
SocketService.ctorParameters = function () { return []; };
|
|
594
|
+
|
|
555
595
|
var ChatDrawerComponent = /** @class */ (function () {
|
|
556
|
-
function ChatDrawerComponent(cdr, http, sanitizer, elementRef, renderer, conversation
|
|
596
|
+
function ChatDrawerComponent(cdr, http, sanitizer, elementRef, renderer, socketService, conversation
|
|
557
597
|
// private platform: Platform
|
|
558
598
|
) {
|
|
559
599
|
var _this = this;
|
|
@@ -562,6 +602,7 @@
|
|
|
562
602
|
this.sanitizer = sanitizer;
|
|
563
603
|
this.elementRef = elementRef;
|
|
564
604
|
this.renderer = renderer;
|
|
605
|
+
this.socketService = socketService;
|
|
565
606
|
this.conversation = conversation;
|
|
566
607
|
this.bodyOverflowClass = 'body-overflow-hidden';
|
|
567
608
|
this.isCollapsedTrue = false;
|
|
@@ -682,6 +723,40 @@
|
|
|
682
723
|
});
|
|
683
724
|
this.fetchAgents();
|
|
684
725
|
this.cdr.markForCheck();
|
|
726
|
+
this.initializeSocketAndListen();
|
|
727
|
+
};
|
|
728
|
+
ChatDrawerComponent.prototype.initializeSocketAndListen = function () {
|
|
729
|
+
var _this = this;
|
|
730
|
+
this.eventSubscription = this.socketService.onEvent('webresult').subscribe(function (data) {
|
|
731
|
+
console.log('Event received webresult:', data);
|
|
732
|
+
_this.handleEvent(data, 'webresult');
|
|
733
|
+
});
|
|
734
|
+
this.eventSubscription = this.socketService.onEvent('answer').subscribe(function (data) {
|
|
735
|
+
console.log('Event received answer:', data);
|
|
736
|
+
_this.handleEvent(data, 'answer');
|
|
737
|
+
});
|
|
738
|
+
this.eventSubscription = this.socketService.onEvent('graph').subscribe(function (data) {
|
|
739
|
+
console.log('Event received graph:', data);
|
|
740
|
+
_this.handleEvent(data, 'graph');
|
|
741
|
+
});
|
|
742
|
+
};
|
|
743
|
+
ChatDrawerComponent.prototype.handleEvent = function (data, type) {
|
|
744
|
+
switch (type) {
|
|
745
|
+
case 'webresult':
|
|
746
|
+
break;
|
|
747
|
+
case 'answer':
|
|
748
|
+
break;
|
|
749
|
+
case 'graph':
|
|
750
|
+
break;
|
|
751
|
+
default:
|
|
752
|
+
break;
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
ChatDrawerComponent.prototype.ngOnDestroy = function () {
|
|
756
|
+
if (this.eventSubscription) {
|
|
757
|
+
this.eventSubscription.unsubscribe();
|
|
758
|
+
}
|
|
759
|
+
this.socketService.close();
|
|
685
760
|
};
|
|
686
761
|
ChatDrawerComponent.prototype.changeTemperature = function (newTemperature) {
|
|
687
762
|
if (this.loading)
|
|
@@ -1477,18 +1552,21 @@
|
|
|
1477
1552
|
};
|
|
1478
1553
|
ChatDrawerComponent.prototype.onCloseSource = function () {
|
|
1479
1554
|
this.sourcesDrawer.close();
|
|
1480
|
-
this.isDrawerOpen =
|
|
1555
|
+
this.isDrawerOpen = true;
|
|
1481
1556
|
this.cdr.detectChanges(); // Trigger change detection if needed
|
|
1482
|
-
this.onDrawerClosed();
|
|
1557
|
+
//this.onDrawerClosed();
|
|
1483
1558
|
};
|
|
1484
1559
|
ChatDrawerComponent.prototype.onDrawerClosed = function () {
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
button
|
|
1491
|
-
|
|
1560
|
+
var _this = this;
|
|
1561
|
+
setTimeout(function () {
|
|
1562
|
+
_this.isDrawerOpen = true;
|
|
1563
|
+
_this.cdr.detectChanges(); // Trigger change detection if needed
|
|
1564
|
+
// Use ngClass to dynamically apply the class
|
|
1565
|
+
var button = document.getElementById('botcloseplaygroundbutton');
|
|
1566
|
+
if (button) {
|
|
1567
|
+
button.style.display = 'block';
|
|
1568
|
+
}
|
|
1569
|
+
}, 0);
|
|
1492
1570
|
};
|
|
1493
1571
|
ChatDrawerComponent.prototype.toggleDrawer = function (todo) {
|
|
1494
1572
|
this.isDrawerOpen = todo;
|
|
@@ -1517,6 +1595,7 @@
|
|
|
1517
1595
|
{ type: platformBrowser.DomSanitizer },
|
|
1518
1596
|
{ type: i0.ElementRef },
|
|
1519
1597
|
{ type: i0.Renderer2 },
|
|
1598
|
+
{ type: SocketService },
|
|
1520
1599
|
{ type: ConversationService }
|
|
1521
1600
|
]; };
|
|
1522
1601
|
ChatDrawerComponent.propDecorators = {
|
|
@@ -1791,9 +1870,10 @@
|
|
|
1791
1870
|
exports.ChatBotComponent = ChatBotComponent;
|
|
1792
1871
|
exports.ChatDrawerComponent = ChatDrawerComponent;
|
|
1793
1872
|
exports.HiveGptModule = HiveGptModule;
|
|
1794
|
-
exports.ɵa =
|
|
1795
|
-
exports.ɵb =
|
|
1796
|
-
exports.ɵc =
|
|
1873
|
+
exports.ɵa = SocketService;
|
|
1874
|
+
exports.ɵb = ConversationService;
|
|
1875
|
+
exports.ɵc = VideoPlayerComponent;
|
|
1876
|
+
exports.ɵd = SafeHtmlPipe;
|
|
1797
1877
|
|
|
1798
1878
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1799
1879
|
|