@hivegpt/hiveai-angular 0.0.156 → 0.0.159
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 +100 -45
- 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 +3 -3
- package/esm2015/hivegpt-hiveai-angular.js +4 -3
- package/esm2015/lib/components/NotificationSocket.js +25 -0
- package/esm2015/lib/components/chat-drawer/chat-drawer.component.js +19 -14
- package/esm2015/lib/components/conversation.service.js +10 -1
- package/esm2015/lib/components/socket-service.service.js +45 -27
- package/fesm2015/hivegpt-hiveai-angular.js +95 -43
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/hivegpt-hiveai-angular.d.ts +3 -2
- package/hivegpt-hiveai-angular.d.ts.map +1 -1
- package/hivegpt-hiveai-angular.metadata.json +1 -1
- package/lib/components/NotificationSocket.d.ts +5 -0
- package/lib/components/NotificationSocket.d.ts.map +1 -0
- package/lib/components/chat-drawer/chat-drawer.component.d.ts +4 -0
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/lib/components/conversation.service.d.ts +4 -0
- package/lib/components/conversation.service.d.ts.map +1 -1
- package/lib/components/socket-service.service.d.ts +16 -8
- package/lib/components/socket-service.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,42 +1,60 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { prod_environment } from '../../environments/environment';
|
|
2
|
+
import { ConversationService } from './conversation.service';
|
|
3
|
+
import { NotificationSocket } from './NotificationSocket';
|
|
5
4
|
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "./conversation.service";
|
|
6
|
+
import * as i2 from "./NotificationSocket";
|
|
6
7
|
export class SocketService {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.
|
|
8
|
+
constructor(conversationService, notificationSocket) {
|
|
9
|
+
this.conversationService = conversationService;
|
|
10
|
+
this.notificationSocket = notificationSocket;
|
|
11
|
+
this.isCommonSocketInitialized = false;
|
|
12
|
+
this.isUserSpecificSocketInitialized = false;
|
|
13
|
+
this.isUserSpecificEventReleased = true;
|
|
14
|
+
this.messageQueue = [];
|
|
15
|
+
this.releaseInterval = 1000;
|
|
16
|
+
this.intervalSetup = false;
|
|
17
|
+
this.startReleasingMessages();
|
|
9
18
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
isSocketInitialized(isCommon) {
|
|
20
|
+
return isCommon
|
|
21
|
+
? this.isCommonSocketInitialized
|
|
22
|
+
: this.isUserSpecificSocketInitialized &&
|
|
23
|
+
!this.isUserSpecificEventReleased;
|
|
14
24
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// Handle incoming messages
|
|
25
|
+
disconnectSocketConnection() {
|
|
26
|
+
this.notificationSocket.disconnect();
|
|
18
27
|
}
|
|
19
|
-
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.
|
|
28
|
+
registerUserSpecificHiveSocket(botId, conversation_id) {
|
|
29
|
+
this.notificationSocket.emit('joinData', {
|
|
30
|
+
groupId: "Hive_AI_Notifs_" + botId + "_" + conversation_id,
|
|
31
|
+
});
|
|
32
|
+
this.notificationSocket
|
|
33
|
+
.fromEvent('commonNotification')
|
|
34
|
+
.subscribe((res) => {
|
|
35
|
+
this.conversationService.sendValidatedUserData(res);
|
|
36
|
+
});
|
|
24
37
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
|
|
38
|
+
startReleasingMessages() {
|
|
39
|
+
if (!this.intervalSetup) {
|
|
40
|
+
setInterval(() => {
|
|
41
|
+
if (this.messageQueue.length > 0) {
|
|
42
|
+
const message = this.messageQueue.shift(); // Remove the first message from the queue
|
|
43
|
+
// this.campaignService.sendValidatedUserData(message);
|
|
30
44
|
}
|
|
31
|
-
});
|
|
32
|
-
|
|
45
|
+
}, this.releaseInterval);
|
|
46
|
+
this.intervalSetup = true; // Prevents multiple intervals
|
|
47
|
+
}
|
|
33
48
|
}
|
|
34
49
|
}
|
|
35
|
-
SocketService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SocketService_Factory() { return new SocketService(); }, token: SocketService, providedIn: "root" });
|
|
50
|
+
SocketService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SocketService_Factory() { return new SocketService(i0.ɵɵinject(i1.ConversationService), i0.ɵɵinject(i2.NotificationSocket)); }, token: SocketService, providedIn: "root" });
|
|
36
51
|
SocketService.decorators = [
|
|
37
52
|
{ type: Injectable, args: [{
|
|
38
53
|
providedIn: 'root'
|
|
39
54
|
},] }
|
|
40
55
|
];
|
|
41
|
-
SocketService.ctorParameters = () => [
|
|
42
|
-
|
|
56
|
+
SocketService.ctorParameters = () => [
|
|
57
|
+
{ type: ConversationService },
|
|
58
|
+
{ type: NotificationSocket }
|
|
59
|
+
];
|
|
60
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic29ja2V0LXNlcnZpY2Uuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiJEOi9oaXZlR1BULUFJLXBhY2thZ2VzL0hpdmVBSS1QYWNrYWdlcy9wcm9qZWN0cy9oaXZlZ3B0L2V2ZW50c2dwdC1hbmd1bGFyL3NyYy8iLCJzb3VyY2VzIjpbImxpYi9jb21wb25lbnRzL3NvY2tldC1zZXJ2aWNlLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUszQyxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQzt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tcbiAgICAgICAgfVxuICAgICAgfSwgdGhpcy5yZWxlYXNlSW50ZXJ2YWwpO1xuICAgICAgdGhpcy5pbnRlcnZhbFNldHVwID0gdHJ1ZTsgLy8gUHJldmVudHMgbXVsdGlwbGUgaW50ZXJ2YWxzXG4gICAgfVxuICB9XG59XG4iXX0=
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { HttpHeaders, HttpClient } from '@angular/common/http';
|
|
2
|
-
import { ɵɵdefineInjectable, Injectable, EventEmitter, ElementRef, Component, ChangeDetectionStrategy, ChangeDetectorRef, Renderer2, ViewChild, ViewChildren, Input, Output, Pipe, Inject, NgModule } from '@angular/core';
|
|
2
|
+
import { ɵɵdefineInjectable, Injectable, ɵɵinject, EventEmitter, ElementRef, Component, ChangeDetectionStrategy, ChangeDetectorRef, Renderer2, ViewChild, ViewChildren, Input, Output, Pipe, Inject, NgModule } from '@angular/core';
|
|
3
3
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
|
-
import {
|
|
4
|
+
import { Subject, of } from 'rxjs';
|
|
5
5
|
import { switchMap, catchError } from 'rxjs/operators';
|
|
6
|
-
import {
|
|
6
|
+
import { Socket } from 'ngx-socket-io';
|
|
7
7
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
8
8
|
import { FormsModule } from '@angular/forms';
|
|
9
9
|
import { MatIconModule } from '@angular/material/icon';
|
|
@@ -49,19 +49,20 @@ const prod_environment = {
|
|
|
49
49
|
BASE_URL: 'https://agent-api.hivegpt.ai',
|
|
50
50
|
AGENTS_API: 'https://hive-ai.social27.com/api',
|
|
51
51
|
API_KEY: 'b621eb3f-0bd2-41d5-a48c-a8f8ab7d38f8',
|
|
52
|
-
SocketUrl: 'notif-v2-api.social27.com/api/notifications'
|
|
52
|
+
SocketUrl: 'https://notif-v2-api.social27.com/api/notifications'
|
|
53
53
|
};
|
|
54
54
|
const dev_environment = {
|
|
55
55
|
USERS_API: 'https://pre-user.social27.com/api',
|
|
56
56
|
BASE_URL: 'https://agent-api.hivegpt.ai',
|
|
57
57
|
AGENTS_API: 'https://hive-ai.social27.com/api',
|
|
58
58
|
API_KEY: 'b621eb3f-0bd2-41d5-a48c-a8f8ab7d38f8',
|
|
59
|
-
SocketUrl: 'notif-v2-api.social27.com/api/notifications'
|
|
59
|
+
SocketUrl: 'https://notif-v2-api.social27.com/api/notifications'
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
class ConversationService {
|
|
63
63
|
constructor() {
|
|
64
64
|
this.storageKey = 'conversationKey';
|
|
65
|
+
this.userSepecificNotification = new Subject();
|
|
65
66
|
}
|
|
66
67
|
generateKey() {
|
|
67
68
|
const timestamp = Math.floor(new Date().getTime() / 1000).toString(16);
|
|
@@ -84,6 +85,13 @@ class ConversationService {
|
|
|
84
85
|
this.ensureKeyExists(storageKey, key);
|
|
85
86
|
return localStorage.getItem(storageKey);
|
|
86
87
|
}
|
|
88
|
+
sendValidatedUserData(message) {
|
|
89
|
+
//console.log('lgging messages', message, new Date());\
|
|
90
|
+
this.userSepecificNotification.next(message);
|
|
91
|
+
}
|
|
92
|
+
getUserSpecificNotification() {
|
|
93
|
+
return this.userSepecificNotification.asObservable();
|
|
94
|
+
}
|
|
87
95
|
}
|
|
88
96
|
ConversationService.ɵprov = ɵɵdefineInjectable({ factory: function ConversationService_Factory() { return new ConversationService(); }, token: ConversationService, providedIn: "root" });
|
|
89
97
|
ConversationService.decorators = [
|
|
@@ -93,42 +101,81 @@ ConversationService.decorators = [
|
|
|
93
101
|
];
|
|
94
102
|
ConversationService.ctorParameters = () => [];
|
|
95
103
|
|
|
96
|
-
class
|
|
104
|
+
class NotificationSocket extends Socket {
|
|
97
105
|
constructor() {
|
|
98
|
-
|
|
106
|
+
super(socketConfig);
|
|
99
107
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
}
|
|
109
|
+
NotificationSocket.decorators = [
|
|
110
|
+
{ type: Injectable }
|
|
111
|
+
];
|
|
112
|
+
NotificationSocket.ctorParameters = () => [];
|
|
113
|
+
const socketConfig = {
|
|
114
|
+
url: prod_environment.SocketUrl,
|
|
115
|
+
options: {
|
|
116
|
+
transports: ['websocket', 'polling'],
|
|
117
|
+
reconnection: true,
|
|
118
|
+
autoConnect: true,
|
|
119
|
+
upgrade: true,
|
|
120
|
+
reconnectionDelay: 1000,
|
|
121
|
+
reconnectionDelayMax: 5000,
|
|
122
|
+
reconnectionAttempts: Infinity
|
|
111
123
|
}
|
|
112
|
-
|
|
113
|
-
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
class SocketService {
|
|
127
|
+
constructor(conversationService, notificationSocket) {
|
|
128
|
+
this.conversationService = conversationService;
|
|
129
|
+
this.notificationSocket = notificationSocket;
|
|
130
|
+
this.isCommonSocketInitialized = false;
|
|
131
|
+
this.isUserSpecificSocketInitialized = false;
|
|
132
|
+
this.isUserSpecificEventReleased = true;
|
|
133
|
+
this.messageQueue = [];
|
|
134
|
+
this.releaseInterval = 1000;
|
|
135
|
+
this.intervalSetup = false;
|
|
136
|
+
this.startReleasingMessages();
|
|
137
|
+
}
|
|
138
|
+
isSocketInitialized(isCommon) {
|
|
139
|
+
return isCommon
|
|
140
|
+
? this.isCommonSocketInitialized
|
|
141
|
+
: this.isUserSpecificSocketInitialized &&
|
|
142
|
+
!this.isUserSpecificEventReleased;
|
|
143
|
+
}
|
|
144
|
+
disconnectSocketConnection() {
|
|
145
|
+
this.notificationSocket.disconnect();
|
|
146
|
+
}
|
|
147
|
+
registerUserSpecificHiveSocket(botId, conversation_id) {
|
|
148
|
+
this.notificationSocket.emit('joinData', {
|
|
149
|
+
groupId: "Hive_AI_Notifs_" + botId + "_" + conversation_id,
|
|
150
|
+
});
|
|
151
|
+
this.notificationSocket
|
|
152
|
+
.fromEvent('commonNotification')
|
|
153
|
+
.subscribe((res) => {
|
|
154
|
+
this.conversationService.sendValidatedUserData(res);
|
|
155
|
+
});
|
|
114
156
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
|
|
157
|
+
startReleasingMessages() {
|
|
158
|
+
if (!this.intervalSetup) {
|
|
159
|
+
setInterval(() => {
|
|
160
|
+
if (this.messageQueue.length > 0) {
|
|
161
|
+
const message = this.messageQueue.shift(); // Remove the first message from the queue
|
|
162
|
+
// this.campaignService.sendValidatedUserData(message);
|
|
120
163
|
}
|
|
121
|
-
});
|
|
122
|
-
|
|
164
|
+
}, this.releaseInterval);
|
|
165
|
+
this.intervalSetup = true; // Prevents multiple intervals
|
|
166
|
+
}
|
|
123
167
|
}
|
|
124
168
|
}
|
|
125
|
-
SocketService.ɵprov = ɵɵdefineInjectable({ factory: function SocketService_Factory() { return new SocketService(); }, token: SocketService, providedIn: "root" });
|
|
169
|
+
SocketService.ɵprov = ɵɵdefineInjectable({ factory: function SocketService_Factory() { return new SocketService(ɵɵinject(ConversationService), ɵɵinject(NotificationSocket)); }, token: SocketService, providedIn: "root" });
|
|
126
170
|
SocketService.decorators = [
|
|
127
171
|
{ type: Injectable, args: [{
|
|
128
172
|
providedIn: 'root'
|
|
129
173
|
},] }
|
|
130
174
|
];
|
|
131
|
-
SocketService.ctorParameters = () => [
|
|
175
|
+
SocketService.ctorParameters = () => [
|
|
176
|
+
{ type: ConversationService },
|
|
177
|
+
{ type: NotificationSocket }
|
|
178
|
+
];
|
|
132
179
|
|
|
133
180
|
// import { Platform } from '@angular/cdk/platform';
|
|
134
181
|
class ChatDrawerComponent {
|
|
@@ -262,20 +309,25 @@ class ChatDrawerComponent {
|
|
|
262
309
|
this.fetchAgents();
|
|
263
310
|
this.cdr.markForCheck();
|
|
264
311
|
this.initializeSocketAndListen();
|
|
312
|
+
setTimeout(() => {
|
|
313
|
+
this.listenSockets();
|
|
314
|
+
}, 200);
|
|
315
|
+
}
|
|
316
|
+
initializeSocket() {
|
|
317
|
+
this.socketService.registerUserSpecificHiveSocket(this.botId, this.conversationKey);
|
|
318
|
+
}
|
|
319
|
+
listenSockets() {
|
|
320
|
+
this.eventSubscription = this.conversation
|
|
321
|
+
.getUserSpecificNotification()
|
|
322
|
+
.subscribe((res) => {
|
|
323
|
+
console.log("Socket Data");
|
|
324
|
+
console.log(res);
|
|
325
|
+
}, (err) => {
|
|
326
|
+
this.eventSubscription.unsubscribe();
|
|
327
|
+
console.error('Error in fetching data from socket');
|
|
328
|
+
});
|
|
265
329
|
}
|
|
266
330
|
initializeSocketAndListen() {
|
|
267
|
-
this.eventSubscription = this.socketService.onEvent('webresult').subscribe((data) => {
|
|
268
|
-
console.log('Event received webresult:', data);
|
|
269
|
-
this.handleEvent(data, 'webresult');
|
|
270
|
-
});
|
|
271
|
-
this.eventSubscription = this.socketService.onEvent('answer').subscribe((data) => {
|
|
272
|
-
console.log('Event received answer:', data);
|
|
273
|
-
this.handleEvent(data, 'answer');
|
|
274
|
-
});
|
|
275
|
-
this.eventSubscription = this.socketService.onEvent('graph').subscribe((data) => {
|
|
276
|
-
console.log('Event received graph:', data);
|
|
277
|
-
this.handleEvent(data, 'graph');
|
|
278
|
-
});
|
|
279
331
|
}
|
|
280
332
|
handleEvent(data, type) {
|
|
281
333
|
switch (type) {
|
|
@@ -293,7 +345,7 @@ class ChatDrawerComponent {
|
|
|
293
345
|
if (this.eventSubscription) {
|
|
294
346
|
this.eventSubscription.unsubscribe();
|
|
295
347
|
}
|
|
296
|
-
this.socketService.close();
|
|
348
|
+
//this.socketService.close();
|
|
297
349
|
}
|
|
298
350
|
changeTemperature(newTemperature) {
|
|
299
351
|
if (this.loading)
|
|
@@ -1381,5 +1433,5 @@ HiveGptModule.decorators = [
|
|
|
1381
1433
|
* Generated bundle index. Do not edit.
|
|
1382
1434
|
*/
|
|
1383
1435
|
|
|
1384
|
-
export { ChatBotComponent, ChatDrawerComponent, HiveGptModule, SocketService as ɵa, ConversationService as ɵb,
|
|
1436
|
+
export { ChatBotComponent, ChatDrawerComponent, HiveGptModule, SocketService as ɵa, ConversationService as ɵb, NotificationSocket as ɵc, VideoPlayerComponent as ɵd, SafeHtmlPipe as ɵe };
|
|
1385
1437
|
//# sourceMappingURL=hivegpt-hiveai-angular.js.map
|