@headwai/chat-bubble 4.0.0 → 6.0.0

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.dev.md CHANGED
@@ -15,7 +15,6 @@ The chat bubble is based on a Svelte integration for the [deep-chat](https://www
15
15
 
16
16
  ```bash
17
17
  git clone <your-repo-url>
18
- cd chat-bubble
19
18
  ```
20
19
 
21
20
  2. Install dependencies:
@@ -61,8 +60,7 @@ Create a `.env` by copying `.env.example` file in your project root with the fol
61
60
  <script>
62
61
  // Runtime configuration override
63
62
  window.HEADWAI_CHAT_BUBBLE_CONFIG = {
64
- apiUrl: 'https://customer-api.com/chat',
65
- apiKey: 'customer-api-key',
63
+ apiUrl: 'https://company.localchat.at',
66
64
  modelId: 'gpt-4',
67
65
  };
68
66
  </script>
@@ -73,8 +71,7 @@ Create a `.env` by copying `.env.example` file in your project root with the fol
73
71
  ```html
74
72
  <div
75
73
  data-chat-bubble
76
- data-chat-bubble-api-url="https://api1.com/chat"
77
- data-chat-bubble-api-key="key1"
74
+ data-chat-bubble-api-url="https://company.localchat.at"
78
75
  data-chat-bubble-user-message-background-color="#ff9500"
79
76
  data-chat-bubble-ai-message-background-color="#00c851"
80
77
  data-chat-bubble-user-message-text-color="#ffffff"
@@ -104,8 +101,7 @@ This project builds a standalone widget that can be integrated into any website.
104
101
 
105
102
  ```bash
106
103
  # Production .env file
107
- VITE_CHAT_BUBBLE_API_URL=https://api.customer-domain.com/chat
108
- VITE_CHAT_BUBBLE_API_KEY=prod-api-key
104
+ VITE_CHAT_BUBBLE_API_URL=https://company.localchat.at
109
105
  VITE_CHAT_BUBBLE_MODEL_ID=gpt-4
110
106
  ```
111
107
 
@@ -164,7 +160,7 @@ The chat bubble makes requests to the following API endpoints:
164
160
 
165
161
  #### 1. Chat Completions API
166
162
 
167
- - **Endpoint**: `{apiUrl}/api/chat-bubble/chat/completions`
163
+ - **Endpoint**: `{apiUrl}/api/chat/completions`
168
164
  - **Method**: WebSocket (streaming)
169
165
  - **Purpose**: Main chat conversation endpoint for sending messages and receiving AI responses
170
166
  - **Authentication**: Bearer token via `Authorization` header
@@ -173,7 +169,7 @@ The chat bubble makes requests to the following API endpoints:
173
169
 
174
170
  #### 2. Chat Creation API
175
171
 
176
- - **Endpoint**: `{apiUrl}/api/chat-bubble/v1/chats/new`
172
+ - **Endpoint**: `{apiUrl}/api/v1/chats/new`
177
173
  - **Method**: POST
178
174
  - **Purpose**: Create a new chat session when starting a conversation
179
175
  - **Authentication**: Bearer token via `Authorization` header
@@ -181,7 +177,7 @@ The chat bubble makes requests to the following API endpoints:
181
177
 
182
178
  #### 3. Chat Storage API
183
179
 
184
- - **Endpoint**: `{apiUrl}/api/chat-bubble/v1/chats/{chatId}`
180
+ - **Endpoint**: `{apiUrl}/api/v1/chats/{chatId}`
185
181
  - **Method**: POST
186
182
  - **Purpose**: Store/update chat history and conversation state
187
183
  - **Authentication**: Bearer token via `Authorization` header
@@ -189,7 +185,7 @@ The chat bubble makes requests to the following API endpoints:
189
185
 
190
186
  #### 4. Feedback API
191
187
 
192
- - **Endpoint**: `{apiUrl}/api/chat-bubble/v1/evaluations/feedback`
188
+ - **Endpoint**: `{apiUrl}/api/v1/evaluations/feedback`
193
189
  - **Method**: POST
194
190
  - **Purpose**: Submit user feedback (thumbs up/down) for AI responses
195
191
  - **Authentication**: Bearer token via `Authorization` header
@@ -204,7 +200,6 @@ The chat bubble can be configured using environment variables, data attributes,
204
200
  | Attribute | Environment Variable | Data Attribute | Purpose | Default |
205
201
  | --------- | --------------------------- | --------------------------- | ---------------------------------------- | ------------------- |
206
202
  | `apiUrl` | `VITE_CHAT_BUBBLE_API_URL` | `data-chat-bubble-api-url` | Base URL for API endpoints | `https://localhost` |
207
- | `apiKey` | `VITE_CHAT_BUBBLE_API_KEY` | `data-chat-bubble-api-key` | Authentication token for API requests | `''` |
208
203
  | `modelId` | `VITE_CHAT_BUBBLE_MODEL_ID` | `data-chat-bubble-model-id` | AI model identifier to use for responses | `test-model` |
209
204
 
210
205
  #### Message Configuration
@@ -302,6 +297,66 @@ The chat bubble can be configured using environment variables, data attributes,
302
297
  }
303
298
  ```
304
299
 
300
+ #### Chat Storage Request
301
+
302
+ ```javascript
303
+ {
304
+ "chat": {
305
+ "models": ["model-id"],
306
+ "history": {
307
+ "messages": {
308
+ "message-uuid-1": {
309
+ "id": "message-uuid-1",
310
+ "parentId": null,
311
+ "childrenIds": ["message-uuid-2"],
312
+ "role": "user",
313
+ "content": "user message content",
314
+ "timestamp": 1704636645,
315
+ "models": ["model-id"]
316
+ },
317
+ "message-uuid-2": {
318
+ "id": "message-uuid-2",
319
+ "parentId": "message-uuid-1",
320
+ "childrenIds": [],
321
+ "role": "assistant",
322
+ "content": "assistant response content",
323
+ "model": "model-id",
324
+ "modelId": "model-id",
325
+ "modelIdx": 0,
326
+ "timestamp": 1704636645,
327
+ "sources": []
328
+ }
329
+ },
330
+ "currentId": "message-uuid-2"
331
+ },
332
+ "messages": [
333
+ {
334
+ "id": "message-uuid-1",
335
+ "parentId": null,
336
+ "childrenIds": ["message-uuid-2"],
337
+ "role": "user",
338
+ "content": "user message content",
339
+ "timestamp": 1704636645,
340
+ "models": ["model-id"]
341
+ },
342
+ {
343
+ "id": "message-uuid-2",
344
+ "parentId": "message-uuid-1",
345
+ "childrenIds": [],
346
+ "role": "assistant",
347
+ "content": "assistant response content",
348
+ "model": "model-id",
349
+ "modelId": "model-id",
350
+ "modelIdx": 0,
351
+ "timestamp": 1704636645,
352
+ "sources": []
353
+ }
354
+ ],
355
+ "params": {}
356
+ }
357
+ }
358
+ ```
359
+
305
360
  #### Feedback Request
306
361
 
307
362
  ```javascript
@@ -352,7 +407,6 @@ This component is designed to work with OpenAI-compatible APIs. The request and
352
407
  ### Common Issues
353
408
 
354
409
  **CORS Errors**: Ensure your API endpoint allows requests from your domain
355
- **Authentication Failures**: Verify your API key is correct and has proper permissions
356
410
  **Environment Variables Not Loading**: Ensure variables are prefixed with `VITE_CHAT_BUBBLE_`
357
411
  **CDN Version Delays**: Sometimes the `@latest` tag on jsDelivr CDN takes time to propagate to all edge servers and may not deliver the newest version immediately. If you need the latest features or fixes, specify the exact version number instead of using `@latest`:
358
412
 
package/README.md CHANGED
@@ -23,7 +23,6 @@ Add the Headwai Chat Bubble to the respective .html file.
23
23
  // Runtime configuration override
24
24
  window.HEADWAI_CHAT_BUBBLE_CONFIG = {
25
25
  apiUrl: 'https://company.localchat.at', // required
26
- apiKey: 'chat-bubble-proxy-api-key', // required
27
26
  modelId: 'customer-support-model-id', // required
28
27
  maxMessages: 0, // optional - 0 means unlimited
29
28
  placeholderText: 'Ask your question here!', // optional - default: 'Enter your questions here'
@@ -86,7 +85,6 @@ For multiple instances use data attributes of the `<div>` tag for configuration
86
85
  <div
87
86
  data-chat-bubble
88
87
  data-chat-bubble-api-url="https://company.localchat.at"
89
- data-chat-bubble-api-key="chat-bubble-proxy-api-key"
90
88
  data-chat-bubble-model-id="customer-support-model-id"
91
89
  data-chat-bubble-max-messages="0"
92
90
  data-chat-bubble-placeholder-text="Ask your question here!"
@@ -106,7 +104,6 @@ For multiple instances use data attributes of the `<div>` tag for configuration
106
104
  <div
107
105
  data-chat-bubble
108
106
  data-chat-bubble-api-url="https://company.localchat.at"
109
- data-chat-bubble-api-key="chat-bubble-proxy-api-key"
110
107
  data-chat-bubble-model-id="FAQ-model-id"
111
108
  data-chat-bubble-max-messages="10"
112
109
  data-chat-bubble-placeholder-text="Ask about our FAQ..."
@@ -144,31 +141,6 @@ The base URL of your LocalChat API endpoint where the chat bubble will send mess
144
141
  apiUrl: 'https://company.localchat.at';
145
142
  ```
146
143
 
147
- #### `apiKey`
148
-
149
- **Type:** `string` | **Required:** ✅
150
- The API Key of the dedicated Headwai Chat Bubble Proxy for LocalChat.
151
-
152
- ```javascript
153
- apiKey: 'chat-bubble-proxy-api-key';
154
- ```
155
-
156
- **How to get your API Key:**
157
-
158
- 1. **Access Settings**: Login to LocalChat with the dedicated Headwai Chat Bubble user (All conversations will be stored at this user's chats list) and click on the user menu, then select `Settings`.
159
-
160
- <img src="docs/images/settings.png" alt="LocalChat User Menu" width="50%" />
161
-
162
- 2. **Navigate to Account**: In the Settings sidebar, click on `Account` to access your account settings.
163
-
164
- <img src="docs/images/api-keys.png" alt="LocalChat Settings Account" width="50%" />
165
-
166
- 3. **Get your API credentials**: In the API keys section, you have two options:
167
- - **JWT Token**: Copy the existing JWT Token (expires after 7 days)
168
- - **API Key**: Generate an API Key via `Generate API Key` button. Click the copy button next to the API Key field, or click the refresh button to generate a new permanent API Key
169
-
170
- **⚠️ Security Note:** When using permanent API Keys, ensure they are stored securely (e.g., environment variables, secure configuration) and never expose them directly in client-side code. If using JWT Tokens, implement an automatic refresh mechanism since they expire after 7 days - consider using a server-side proxy to handle token renewal and keep tokens secure.
171
-
172
144
  #### `modelId`
173
145
 
174
146
  **Type:** `string` | **Required:** ✅
@@ -338,7 +310,6 @@ When using data attributes for multiple chat bubbles, convert camelCase property
338
310
  ### Common Issues
339
311
 
340
312
  **CORS Errors**: Ensure your API endpoint allows requests from your domain
341
- **Authentication Failures**: Verify your API key is correct and has proper permissions
342
313
  **CDN Version Delays**: Sometimes the `@latest` tag on jsDelivr CDN takes time to propagate to all edge servers and may not deliver the newest version immediately. If you need the latest features or fixes, specify the exact version number instead of using `@latest`:
343
314
 
344
315
  ```html