@hivegpt/hiveai-angular 0.0.464 → 0.0.466

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/README.md CHANGED
@@ -139,6 +139,7 @@ In your template, add the chatbot and pass the required inputs:
139
139
  | **rules** | string | No | Rules. |
140
140
  | **gradientColors** | string[] | No | Gradient colors. |
141
141
  | **isDev** | boolean | No | If `true`, uses dev API base URL; otherwise prod. Pass through to chat-drawer so voice/chat use the correct backend. |
142
+ | **baseUrl** | string | No | Optional API base URL. When set, all chat and voice requests use this URL instead of the dev/prod default (e.g. `https://your-tunnel.ngrok.io` for local/dev tunneling). |
142
143
 
143
144
  ### Voice agent
144
145
 
@@ -147,7 +148,7 @@ The chatbot includes a **voice agent** (microphone button). For it to work you m
147
148
  - **s27Token** – JWT sent as `Authorization: Bearer <token>` to `POST baseurl/ai/ask-voice`.
148
149
  - **botId** – Sent as `bot_id` in the request body.
149
150
 
150
- The **base URL** for the API comes from the library’s environment (dev or prod, controlled by **isDev**). The library calls `POST {baseUrl}/ai/ask-voice` and uses the returned `ws_url` for the WebSocket. The chat drawer derives **conversation_id** from the current conversation and sends it with **bot_id** and **voice: "alloy"**. No extra input is needed for conversation context; ensure **apiKey**, **botId**, **userId**, **s27Token**, and **isDev** (if you need dev vs prod) are set where you use the package.
151
+ The **base URL** for the API comes from the library’s environment (dev or prod, controlled by **isDev**), unless you pass **baseUrl** (e.g. an ngrok URL for local development). The library calls `POST {baseUrl}/ai/ask-voice` and uses the returned `ws_url` for the WebSocket. The chat drawer derives **conversation_id** from the current conversation and sends it with **bot_id** and **voice: "alloy"**. No extra input is needed for conversation context; ensure **apiKey**, **botId**, **userId**, **s27Token**, and **isDev** (if you need dev vs prod) are set where you use the package.
151
152
 
152
153
  ### Minimal example
153
154
 
@@ -818,7 +818,7 @@
818
818
 
819
819
  var prod_environment = {
820
820
  USERS_API: 'https://es-user.social27.com/api',
821
- BASE_URL: 'https://af5f-122-160-16-108.ngrok-free.app',
821
+ BASE_URL: 'https://agent-api.hivegpt.ai',
822
822
  AGENTS_API: 'https://hive-ai.social27.com/api',
823
823
  API_KEY: '82595783-dc9c-4513-8204-709818d51be3',
824
824
  SocketUrl: 'https://notif-v2-ws.social27.com/'
@@ -2228,6 +2228,21 @@
2228
2228
  if (changes.orgId && changes.orgId.currentValue != changes.orgId.previousValue) {
2229
2229
  this.chatSocketInitialized = false;
2230
2230
  }
2231
+ if (changes.baseUrl && this.environment) {
2232
+ this.applyBaseUrlOverride();
2233
+ }
2234
+ };
2235
+ /** When baseUrl input is set, override environment.BASE_URL so all chat/voice services use it (supports ngrok etc.). */
2236
+ ChatDrawerComponent.prototype.applyBaseUrlOverride = function () {
2237
+ var defaultEnv = this.isDev ? dev_environment : prod_environment;
2238
+ if (this.baseUrl && typeof this.baseUrl === 'string') {
2239
+ var url = this.baseUrl.trim().replace(/\/+$/, '');
2240
+ if (url) {
2241
+ this.environment = Object.assign(Object.assign({}, defaultEnv), { BASE_URL: url });
2242
+ return;
2243
+ }
2244
+ }
2245
+ this.environment = defaultEnv;
2231
2246
  };
2232
2247
  ChatDrawerComponent.prototype.ngOnInit = function () {
2233
2248
  var _this = this;
@@ -2235,7 +2250,7 @@
2235
2250
  if (this.eventId) {
2236
2251
  this.translationService.setEventId(this.eventId);
2237
2252
  }
2238
- this.environment = this.isDev ? dev_environment : prod_environment;
2253
+ this.applyBaseUrlOverride();
2239
2254
  var domain = window.location.hostname;
2240
2255
  // Determine the header value based on the domain
2241
2256
  if (domain.includes('pre-app.social27.com')) {
@@ -4408,6 +4423,7 @@
4408
4423
  useOpenAi: [{ type: i0.Input }],
4409
4424
  userId: [{ type: i0.Input }],
4410
4425
  isDev: [{ type: i0.Input }],
4426
+ baseUrl: [{ type: i0.Input }],
4411
4427
  againButtonColor: [{ type: i0.Input }],
4412
4428
  againButtonTextColor: [{ type: i0.Input }],
4413
4429
  feedbackEvent: [{ type: i0.Output }],
@@ -4433,7 +4449,7 @@
4433
4449
  ChatBotComponent.decorators = [
4434
4450
  { type: i0.Component, args: [{
4435
4451
  selector: 'hivegpt-chatbot',
4436
- template: "<button mat-icon-button class=\"chat-button\" color=\"primary\" (click)=\"toggle()\">\n <mat-icon>chat</mat-icon>\n</button>\n\n<ng-container *ngIf=\"visible\">\n <hivegpt-chat-drawer-package\n [apiKey]=\"apiKey\"\n [bgBubbleAi]=\"bgBubbleAi\"\n [bgBubbleUser]=\"bgBubbleUser\"\n [bgGradient]=\"bgGradient\"\n [botName]=\"botName\"\n [closeButtonbgColor]=\"closeButtonbgColor\"\n [closeButtonColor]=\"closeButtonColor\"\n [credentials]=\"credentials\"\n [dateTextColor]=\"dateTextColor\"\n [dateTimeColor]=\"dateTimeColor\"\n [eventId]=\"eventId\"\n [eventName]=\"eventName\"\n [formFieldBgColor]=\"formFieldBgColor\"\n [formFieldTextColor]=\"formFieldTextColor\"\n [fullView]=\"fullView\"\n [greeting]=\"greeting\"\n [gradientColors]=\"gradientColors\"\n [messageTextColorAi]=\"messageTextColorAi\"\n [messageTextColorUser]=\"messageTextColorUser\"\n [sendButtonColor]=\"sendButtonColor\"\n [sendButtonTextColor]=\"sendButtonTextColor\"\n [showClose]=\"showClose\"\n [thumbsDownMessages]=\"thumbsDownMessages\"\n [thumbsUpMessage]=\"thumbsUpMessage\"\n [unknownResponses]=\"unknownResponses\"\n [useOpenAi]=\"useOpenAi\"\n [userId]=\"userId\"\n [botId]=\"botId\"\n [s27Token]=\"s27Token\"\n [workspaceToken]=\"workspaceToken\"\n [isDev]=\"isDev\"\n >\n </hivegpt-chat-drawer-package>\n</ng-container>\n",
4452
+ template: "<button mat-icon-button class=\"chat-button\" color=\"primary\" (click)=\"toggle()\">\n <mat-icon>chat</mat-icon>\n</button>\n\n<ng-container *ngIf=\"visible\">\n <hivegpt-chat-drawer-package\n [apiKey]=\"apiKey\"\n [bgBubbleAi]=\"bgBubbleAi\"\n [bgBubbleUser]=\"bgBubbleUser\"\n [bgGradient]=\"bgGradient\"\n [botName]=\"botName\"\n [closeButtonbgColor]=\"closeButtonbgColor\"\n [closeButtonColor]=\"closeButtonColor\"\n [credentials]=\"credentials\"\n [dateTextColor]=\"dateTextColor\"\n [dateTimeColor]=\"dateTimeColor\"\n [eventId]=\"eventId\"\n [eventName]=\"eventName\"\n [formFieldBgColor]=\"formFieldBgColor\"\n [formFieldTextColor]=\"formFieldTextColor\"\n [fullView]=\"fullView\"\n [greeting]=\"greeting\"\n [gradientColors]=\"gradientColors\"\n [messageTextColorAi]=\"messageTextColorAi\"\n [messageTextColorUser]=\"messageTextColorUser\"\n [sendButtonColor]=\"sendButtonColor\"\n [sendButtonTextColor]=\"sendButtonTextColor\"\n [showClose]=\"showClose\"\n [thumbsDownMessages]=\"thumbsDownMessages\"\n [thumbsUpMessage]=\"thumbsUpMessage\"\n [unknownResponses]=\"unknownResponses\"\n [useOpenAi]=\"useOpenAi\"\n [userId]=\"userId\"\n [botId]=\"botId\"\n [s27Token]=\"s27Token\"\n [workspaceToken]=\"workspaceToken\"\n [isDev]=\"isDev\"\n [baseUrl]=\"baseUrl\"\n >\n </hivegpt-chat-drawer-package>\n</ng-container>\n",
4437
4453
  styles: ["::-webkit-scrollbar{width:5px}::-webkit-scrollbar-track{background:#f1f1f1}::-webkit-scrollbar-thumb,::-webkit-scrollbar-thumb:hover{background:#e5ccbc}.spinner{align-items:center;display:flex;gap:2px;justify-content:center}.spinner>div{animation:bouncedelay 1.4s ease-in-out infinite;animation-fill-mode:both;background-color:#173330;border-radius:100%;display:inline-block;height:5px;width:5px}.spinner .bounce1{animation-delay:-.32s}.spinner .bounce2{animation-delay:-.16s}@keyframes bouncedelay{0%,80%,to{-webkit-transform:scale(0);transform:scale(0)}40%{-webkit-transform:scale(1);transform:scale(1)}}.chat-button{align-items:center;background:#17235b;border:#17235b;border-radius:50%;bottom:20px;color:#fff;display:inline-flex;font-size:24px;height:50px;justify-content:center;position:fixed;right:20px;width:50px}"]
4438
4454
  },] }
4439
4455
  ];
@@ -4471,7 +4487,8 @@
4471
4487
  eventId: [{ type: i0.Input }],
4472
4488
  s27Token: [{ type: i0.Input }],
4473
4489
  workspaceToken: [{ type: i0.Input }],
4474
- isDev: [{ type: i0.Input }]
4490
+ isDev: [{ type: i0.Input }],
4491
+ baseUrl: [{ type: i0.Input }]
4475
4492
  };
4476
4493
 
4477
4494
  /**