@hivegpt/hiveai-angular 0.0.389 → 0.0.399
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 +140 -2
- package/bundles/hivegpt-hiveai-angular.umd.js +580 -10
- 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/environments/environment.d.ts.map +1 -1
- package/esm2015/environments/environment.js +1 -1
- package/esm2015/hivegpt-hiveai-angular.js +1 -1
- package/esm2015/lib/components/NotificationSocket.js +1 -1
- package/esm2015/lib/components/bot-html-editor/bot-html-editor.component.js +1 -1
- package/esm2015/lib/components/bot.service.js +1 -1
- package/esm2015/lib/components/chat-drawer/chat-drawer.component.js +67 -4
- package/esm2015/lib/components/chatbot/chatbot.component.js +6 -3
- package/esm2015/lib/components/conversation.service.js +1 -1
- package/esm2015/lib/components/socket-service.service.js +1 -1
- package/esm2015/lib/components/translations/translation.service.js +1 -1
- package/esm2015/lib/components/video-player/video-player.component.js +1 -1
- package/esm2015/lib/components/voice-agent/components/voice-agent-modal/voice-agent-modal.component.js +100 -0
- package/esm2015/lib/components/voice-agent/services/audio-analyzer.service.js +119 -0
- package/esm2015/lib/components/voice-agent/services/voice-agent.service.js +222 -0
- package/esm2015/lib/components/voice-agent/voice-agent.module.js +25 -0
- package/esm2015/lib/hivegpt.module.js +4 -3
- package/esm2015/lib/models/video.js +1 -1
- package/esm2015/lib/pipes/safe-html.pipe.js +1 -1
- package/esm2015/lib/utils/utils.js +1 -1
- package/esm2015/public-api.js +5 -1
- package/fesm2015/hivegpt-hiveai-angular.js +525 -11
- package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
- package/hivegpt-hiveai-angular.d.ts.map +1 -1
- package/hivegpt-hiveai-angular.metadata.json +1 -1
- package/lib/components/NotificationSocket.d.ts.map +1 -1
- package/lib/components/bot-html-editor/bot-html-editor.component.d.ts.map +1 -1
- package/lib/components/bot.service.d.ts.map +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts +19 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/lib/components/chatbot/chatbot.component.d.ts +3 -0
- package/lib/components/chatbot/chatbot.component.d.ts.map +1 -1
- package/lib/components/conversation.service.d.ts.map +1 -1
- package/lib/components/socket-service.service.d.ts.map +1 -1
- package/lib/components/translations/translation.service.d.ts.map +1 -1
- package/lib/components/video-player/video-player.component.d.ts.map +1 -1
- package/lib/components/voice-agent/components/voice-agent-modal/voice-agent-modal.component.d.ts +32 -0
- package/lib/components/voice-agent/components/voice-agent-modal/voice-agent-modal.component.d.ts.map +1 -0
- package/lib/components/voice-agent/services/audio-analyzer.service.d.ts +23 -0
- package/lib/components/voice-agent/services/audio-analyzer.service.d.ts.map +1 -0
- package/lib/components/voice-agent/services/voice-agent.service.d.ts +41 -0
- package/lib/components/voice-agent/services/voice-agent.service.d.ts.map +1 -0
- package/lib/components/voice-agent/voice-agent.module.d.ts +3 -0
- package/lib/components/voice-agent/voice-agent.module.d.ts.map +1 -0
- package/lib/hivegpt.module.d.ts.map +1 -1
- package/lib/models/video.d.ts.map +1 -1
- package/lib/pipes/safe-html.pipe.d.ts.map +1 -1
- package/lib/utils/utils.d.ts.map +1 -1
- package/package.json +3 -1
- package/public-api.d.ts +4 -0
- package/public-api.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,144 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @hivegpt/hiveai-angular
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Angular library for the HiveGPT chatbot and voice agent.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @hivegpt/hiveai-angular
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Install peer dependencies if not already present:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @angular/animations @angular/cdk @angular/common @angular/compiler @angular/core @angular/forms @angular/material @angular/platform-browser ngx-quill ngx-socket-io @pipecat-ai/client-js @pipecat-ai/websocket-transport
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### 1. Import the module
|
|
20
|
+
|
|
21
|
+
In your Angular app module (e.g. `app.module.ts`):
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { HiveGptModule } from '@hivegpt/hiveai-angular';
|
|
25
|
+
|
|
26
|
+
@NgModule({
|
|
27
|
+
imports: [
|
|
28
|
+
// ... other imports
|
|
29
|
+
HiveGptModule,
|
|
30
|
+
],
|
|
31
|
+
})
|
|
32
|
+
export class AppModule { }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. Use the chatbot component
|
|
36
|
+
|
|
37
|
+
In your template, add the chatbot and pass the required inputs:
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<hivegpt-chatbot
|
|
41
|
+
[apiKey]="apiKey"
|
|
42
|
+
[botId]="botId"
|
|
43
|
+
[userId]="userId"
|
|
44
|
+
[s27Token]="s27Token"
|
|
45
|
+
[botName]="botName"
|
|
46
|
+
[botSkills]="botSkills"
|
|
47
|
+
[eventId]="eventId"
|
|
48
|
+
[eventName]="eventName"
|
|
49
|
+
[greeting]="greeting"
|
|
50
|
+
[workspaceToken]="workspaceToken"
|
|
51
|
+
[isDev]="isDev"
|
|
52
|
+
[credentials]="credentials"
|
|
53
|
+
[bgGradient]="bgGradient"
|
|
54
|
+
[sendButtonColor]="sendButtonColor"
|
|
55
|
+
[sendButtonTextColor]="sendButtonTextColor"
|
|
56
|
+
[showClose]="showClose"
|
|
57
|
+
[fullView]="fullView"
|
|
58
|
+
[useOpenAi]="useOpenAi"
|
|
59
|
+
[bgBubbleAi]="bgBubbleAi"
|
|
60
|
+
[bgBubbleUser]="bgBubbleUser"
|
|
61
|
+
[closeButtonbgColor]="closeButtonbgColor"
|
|
62
|
+
[closeButtonColor]="closeButtonColor"
|
|
63
|
+
[messageTextColorAi]="messageTextColorAi"
|
|
64
|
+
[messageTextColorUser]="messageTextColorUser"
|
|
65
|
+
[dateTimeColor]="dateTimeColor"
|
|
66
|
+
[dateTextColor]="dateTextColor"
|
|
67
|
+
[formFieldBgColor]="formFieldBgColor"
|
|
68
|
+
[formFieldTextColor]="formFieldTextColor"
|
|
69
|
+
[thumbsUpMessage]="thumbsUpMessage"
|
|
70
|
+
[thumbsDownMessages]="thumbsDownMessages"
|
|
71
|
+
[timezone]="timezone"
|
|
72
|
+
[unknownResponses]="unknownResponses"
|
|
73
|
+
[rules]="rules"
|
|
74
|
+
[gradientColors]="gradientColors"
|
|
75
|
+
></hivegpt-chatbot>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Inputs to pass (where the package is called)
|
|
79
|
+
|
|
80
|
+
| Input | Type | Required | Description |
|
|
81
|
+
|-------|------|----------|-------------|
|
|
82
|
+
| **apiKey** | string | Yes | API key for the bot. |
|
|
83
|
+
| **botId** | string | Yes | Bot identifier. |
|
|
84
|
+
| **userId** | string | Yes | User identifier. |
|
|
85
|
+
| **s27Token** | string | Yes | JWT for API auth; also used for **voice agent** (`POST /ai/ask-voice`). |
|
|
86
|
+
| **botName** | string | Yes | Display name for the bot. |
|
|
87
|
+
| **botSkills** | string | No | Bot skills / role description. |
|
|
88
|
+
| **eventId** | string | No | Event ID. |
|
|
89
|
+
| **eventName** | string | No | Event name. |
|
|
90
|
+
| **greeting** | string | No | Initial greeting message. |
|
|
91
|
+
| **workspaceToken** | string | No | Workspace token. |
|
|
92
|
+
| **credentials** | array | No | Credentials. |
|
|
93
|
+
| **bgGradient** | string[] | No | Background gradient colors. |
|
|
94
|
+
| **sendButtonColor** | string | No | Send button color. |
|
|
95
|
+
| **sendButtonTextColor** | string | No | Send button text color. |
|
|
96
|
+
| **showClose** | boolean | No | Show close button. |
|
|
97
|
+
| **fullView** | boolean | No | Use full-width drawer. |
|
|
98
|
+
| **useOpenAi** | boolean | No | Use OpenAI. |
|
|
99
|
+
| **bgBubbleAi** | string | No | AI bubble background. |
|
|
100
|
+
| **bgBubbleUser** | string | No | User bubble background. |
|
|
101
|
+
| **closeButtonbgColor** | string | No | Close button background. |
|
|
102
|
+
| **closeButtonColor** | string | No | Close button color. |
|
|
103
|
+
| **messageTextColorAi** | string | No | AI message text color. |
|
|
104
|
+
| **messageTextColorUser** | string | No | User message text color. |
|
|
105
|
+
| **dateTimeColor** | string | No | Date/time color. |
|
|
106
|
+
| **dateTextColor** | string | No | Date text color. |
|
|
107
|
+
| **formFieldBgColor** | string | No | Input field background. |
|
|
108
|
+
| **formFieldTextColor** | string | No | Input field text color. |
|
|
109
|
+
| **thumbsUpMessage** | string | No | Thumbs up message. |
|
|
110
|
+
| **thumbsDownMessages** | string[] | No | Thumbs down messages. |
|
|
111
|
+
| **timezone** | string | No | Timezone. |
|
|
112
|
+
| **unknownResponses** | array | No | Unknown response config. |
|
|
113
|
+
| **rules** | string | No | Rules. |
|
|
114
|
+
| **gradientColors** | string[] | No | Gradient colors. |
|
|
115
|
+
| **isDev** | boolean | No | If `true`, uses dev API base URL; otherwise prod. Pass through to chat-drawer so voice/chat use the correct backend. |
|
|
116
|
+
|
|
117
|
+
### Voice agent
|
|
118
|
+
|
|
119
|
+
The chatbot includes a **voice agent** (microphone button). For it to work you must pass:
|
|
120
|
+
|
|
121
|
+
- **s27Token** – JWT sent as `Authorization: Bearer <token>` to `POST baseurl/ai/ask-voice`.
|
|
122
|
+
- **botId** – Sent as `bot_id` in the request body.
|
|
123
|
+
|
|
124
|
+
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.
|
|
125
|
+
|
|
126
|
+
### Minimal example
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<hivegpt-chatbot
|
|
130
|
+
[apiKey]="'your-api-key'"
|
|
131
|
+
[botId]="'your-bot-id'"
|
|
132
|
+
[userId]="'your-user-id'"
|
|
133
|
+
[s27Token]="authToken"
|
|
134
|
+
[botName]="'Assistant'"
|
|
135
|
+
[eventId]="eventId"
|
|
136
|
+
[eventName]="eventName"
|
|
137
|
+
[greeting]="'Hello!'"
|
|
138
|
+
></hivegpt-chatbot>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Ensure your app provides a valid **s27Token** and, if needed, **isDev** so chat and voice agent use the correct API base URL.
|
|
4
142
|
|
|
5
143
|
## Code scaffolding
|
|
6
144
|
|