@hivegpt/hiveai-angular 0.0.328 → 0.0.330

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.
@@ -670,11 +670,12 @@
670
670
  this.eventDescription = new rxjs.Subject();
671
671
  this.bot_api = 'https://agent-api.hivegpt.ai/';
672
672
  }
673
- BotsService.prototype.fetchSpeechAuthorizationToken = function (botId, apiKey) {
673
+ BotsService.prototype.fetchSpeechAuthorizationToken = function (botId, apiKey, domain) {
674
674
  var headers = new i1.HttpHeaders({
675
675
  'Content-Type': 'application/json',
676
676
  'x-api-key': apiKey,
677
- 'hive-bot-id': botId
677
+ 'hive-bot-id': botId,
678
+ 'domain-authority': domain
678
679
  });
679
680
  var apiUrl = this.bot_api + "speech/issue_token";
680
681
  var url = "" + apiUrl;
@@ -849,6 +850,17 @@
849
850
  ChatDrawerComponent.prototype.ngOnInit = function () {
850
851
  var _this = this;
851
852
  this.environment = this.isDev ? dev_environment : prod_environment;
853
+ var domain = window.location.hostname;
854
+ // Determine the header value based on the domain
855
+ if (domain.includes('pre-app.social27.com')) {
856
+ this.domainAuthorityValue = 'pre-prod-lite';
857
+ }
858
+ else if (domain.includes('app.social27.com')) {
859
+ this.domainAuthorityValue = 'prod-lite';
860
+ }
861
+ else if (domain.includes('hivegpt.io')) {
862
+ this.domainAuthorityValue = 'hivegpt';
863
+ }
852
864
  // this.fetchMyConnections().subscribe();
853
865
  // this.fetchPendingRequests().subscribe();
854
866
  this.changeTemperature(this.temperature);
@@ -868,7 +880,7 @@
868
880
  // this.fetchEditorContent();
869
881
  this.cdr.markForCheck();
870
882
  // this.initializeSocket();
871
- this.botService.fetchSpeechAuthorizationToken(this.botId, this.apiKey).subscribe(function (token) {
883
+ this.botService.fetchSpeechAuthorizationToken(this.botId, this.apiKey, this.domainAuthorityValue).subscribe(function (token) {
872
884
  _this.authorizationToken = token;
873
885
  _this.initializeSpeechRecognizer(token);
874
886
  });
@@ -1047,7 +1059,8 @@
1047
1059
  var headers = new i1.HttpHeaders({
1048
1060
  'Content-Type': 'application/json',
1049
1061
  'x-api-key': this.apiKey,
1050
- 'hive-bot-id': this.botId
1062
+ 'hive-bot-id': this.botId,
1063
+ 'domain-authority': this.domainAuthorityValue
1051
1064
  });
1052
1065
  var url = this.environment.BASE_URL + "/bot/clear-history/" + this.botId + "/" + this.userId;
1053
1066
  return this.http.post(url, { headers: headers }).pipe(operators.switchMap(function (res) {
@@ -1061,7 +1074,8 @@
1061
1074
  this.loading = true;
1062
1075
  var headers = new i1.HttpHeaders({
1063
1076
  'x-api-key': this.apiKey,
1064
- 'hive-bot-id': this.botId
1077
+ 'hive-bot-id': this.botId,
1078
+ 'domain-authority': this.domainAuthorityValue
1065
1079
  });
1066
1080
  var url = this.environment.BASE_URL + "/bots?bot_id=" + this.botId;
1067
1081
  return this.http.get(url, { headers: headers }).pipe(operators.switchMap(function (res) {
@@ -1091,7 +1105,8 @@
1091
1105
  var headers = new i1.HttpHeaders({
1092
1106
  accept: 'application/json',
1093
1107
  'x-api-key': this.apiKey,
1094
- 'hive-bot-id': this.botId
1108
+ 'hive-bot-id': this.botId,
1109
+ 'domain-authority': this.domainAuthorityValue
1095
1110
  });
1096
1111
  return this.http
1097
1112
  .get(url, { headers: headers })
@@ -1286,7 +1301,8 @@
1286
1301
  .get(url, {
1287
1302
  headers: {
1288
1303
  'x-api-key': this.apiKey,
1289
- 'hive-bot-id': this.botId
1304
+ 'hive-bot-id': this.botId,
1305
+ 'domain-authority': this.domainAuthorityValue
1290
1306
  },
1291
1307
  })
1292
1308
  .pipe(operators.catchError(function (error) {
@@ -1454,7 +1470,8 @@
1454
1470
  headers: {
1455
1471
  'Content-Type': 'application/json',
1456
1472
  'apiKey': 'Conversation_WIz/qAm+EEmfOkFaUA/weA==',
1457
- 'hive-bot-id': this.botId
1473
+ 'hive-bot-id': this.botId,
1474
+ 'domain-authority': this.domainAuthorityValue
1458
1475
  },
1459
1476
  body: JSON.stringify({ messageId: message._id, isHelpful: flag }),
1460
1477
  }).then(function () {
@@ -1845,6 +1862,7 @@
1845
1862
  var headers = new i1.HttpHeaders({
1846
1863
  'Content-Type': 'application/json',
1847
1864
  apiKey: 'WIz/qAm+EEmfOkFaUA/weA==',
1865
+ 'domain-authority': this.domainAuthorityValue
1848
1866
  });
1849
1867
  return this.http.get(url, { headers: headers }).pipe(operators.switchMap(function (res) {
1850
1868
  if (res) {
@@ -2149,26 +2167,14 @@
2149
2167
  body['workflow_id'] = workflowId;
2150
2168
  body['workflow_inputs'] = workflow_inputs;
2151
2169
  }
2152
- var domain = window.location.hostname;
2153
- // Determine the header value based on the domain
2154
- var domainAuthorityValue = '';
2155
- if (domain.includes('pre-app.social27.com')) {
2156
- domainAuthorityValue = 'pre-prod-lite';
2157
- }
2158
- else if (domain.includes('app.social27.com')) {
2159
- domainAuthorityValue = 'prod-lite';
2160
- }
2161
- else if (domain.includes('hivegpt.io')) {
2162
- domainAuthorityValue = 'hivegpt';
2163
- }
2164
2170
  fetch(url, {
2165
2171
  method: 'POST',
2166
2172
  headers: {
2167
2173
  'Content-Type': 'application/json',
2168
- Authorization: 'Bearer ' + this.s27Token,
2174
+ // Authorization: 'Bearer ' + this.s27Token,
2169
2175
  'x-api-key': this.apiKey,
2170
2176
  'hive-bot-id': this.botId,
2171
- 'domain-authority': domainAuthorityValue
2177
+ 'domain-authority': this.domainAuthorityValue
2172
2178
  },
2173
2179
  body: JSON.stringify(body),
2174
2180
  })