@hivegpt/hiveai-angular 0.0.465 → 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 +2 -1
- package/bundles/hivegpt-hiveai-angular.umd.js +20 -3
- 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/lib/components/chat-drawer/chat-drawer.component.js +18 -2
- package/esm2015/lib/components/chatbot/chatbot.component.js +4 -3
- package/fesm2015/hivegpt-hiveai-angular.js +20 -3
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/hivegpt-hiveai-angular.metadata.json +1 -1
- 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/chatbot/chatbot.component.d.ts +2 -0
- package/lib/components/chatbot/chatbot.component.d.ts.map +1 -1
- package/package.json +1 -1
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
|
|
|
@@ -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.
|
|
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
|
/**
|