@nightzeros/chatai-widget 1.3.0 → 1.4.1
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 +8 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1231 -162
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -39,14 +39,20 @@ instance.destroy();
|
|
|
39
39
|
| `showSources` | `boolean` | Show citation chips |
|
|
40
40
|
| `layout` | `"fixed" \| "contained"` | `contained` renders inside the target element |
|
|
41
41
|
| `voice` | `boolean` | Set `false` to hide Voice (preview) |
|
|
42
|
+
| `voiceAppearance` | object | Optional Voice experience override — **1.4.0+** (`experience`, captions, motion) |
|
|
42
43
|
| `signEndpoint` | `string` | Signing endpoint for assistants that require signed widgets |
|
|
43
44
|
| `fetch`, `storage`, `createId` | advanced | Inject `fetch`, a `localStorage`-like store, or an ID generator (useful in tests) |
|
|
44
45
|
|
|
45
|
-
`optionsFromScript(scriptElement)` reads the same options from `data-*` attributes (`data-assistant-id`, `data-api-url`, `data-theme`, `data-position`, `data-sign-endpoint`, `data-voice="off"`).
|
|
46
|
+
`optionsFromScript(scriptElement)` reads the same options from `data-*` attributes (`data-assistant-id`, `data-api-url`, `data-theme`, `data-position`, `data-sign-endpoint`, `data-voice="off"`, `data-voice-experience`, `data-voice-captions`).
|
|
46
47
|
|
|
47
48
|
## Voice (preview)
|
|
48
49
|
|
|
49
|
-
When the assistant offers Voice and the server has a Voice provider configured, the widget adds a microphone button with a live transcript and, when recording is enabled, a consent prompt before the microphone turns on. Voice needs HTTPS (or `localhost`), microphone permission and WebRTC. It is a preview feature
|
|
50
|
+
When the assistant offers Voice and the server has a Voice provider configured, the widget adds a microphone button with a live transcript and, when recording is enabled, a consent prompt before the microphone turns on. Voice needs HTTPS (or `localhost`), microphone permission and WebRTC. It is a preview feature.
|
|
51
|
+
|
|
52
|
+
- **1.2.0+** for the playback gate (older packages are refused with "Voice needs an updated chat widget").
|
|
53
|
+
- **1.4.0+** for Orb, Dock, Guided, Companion, and Side panel. Without it, Customize can select a stage but the npm embed stays Classic.
|
|
54
|
+
|
|
55
|
+
Docs: [Widget](https://docs.nightzeros.com/docs/widget) · [Upgrading to 1.4](https://docs.nightzeros.com/docs/self-hosting/upgrade-1-4).
|
|
50
56
|
|
|
51
57
|
## Compatibility
|
|
52
58
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WidgetControllerOptions } from '@nightzeros/chatai-widget-core';
|
|
1
|
+
import { WidgetControllerOptions, VoiceAppearance } from '@nightzeros/chatai-widget-core';
|
|
2
2
|
|
|
3
3
|
type WidgetSettings = {
|
|
4
4
|
primaryColor?: string;
|
|
@@ -7,6 +7,7 @@ type WidgetSettings = {
|
|
|
7
7
|
iconUrl?: string | null;
|
|
8
8
|
suggestedQuestions?: string[];
|
|
9
9
|
showSources?: boolean;
|
|
10
|
+
voiceAppearance?: VoiceAppearance;
|
|
10
11
|
};
|
|
11
12
|
type WidgetAppProps = WidgetControllerOptions & WidgetSettings & {
|
|
12
13
|
layout?: "fixed" | "contained";
|
|
@@ -15,6 +16,8 @@ type WidgetAppProps = WidgetControllerOptions & WidgetSettings & {
|
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
type WidgetInstance = {
|
|
19
|
+
/** Re-render with merged options without destroying the controller when identity deps are unchanged. */
|
|
20
|
+
update(next: Partial<WidgetMountOptions>): void;
|
|
18
21
|
destroy(): void;
|
|
19
22
|
};
|
|
20
23
|
type WidgetMountOptions = WidgetAppProps;
|
|
@@ -25,6 +28,7 @@ type ScriptOptions = Pick<WidgetControllerOptions, "assistantId" | "apiUrl" | "s
|
|
|
25
28
|
position?: "bottom-left" | "bottom-right";
|
|
26
29
|
/** `data-voice="off"` hides Voice even when the assistant offers it. */
|
|
27
30
|
voice?: boolean;
|
|
31
|
+
voiceAppearance?: VoiceAppearance;
|
|
28
32
|
};
|
|
29
33
|
declare function optionsFromScript(script: HTMLScriptElement): ScriptOptions;
|
|
30
34
|
|