@unith-ai/core-client 2.0.4-beta.5 → 2.0.5-beta.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 +15 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/lib.modern.js +2 -0
- package/dist/lib.modern.js.map +1 -0
- package/dist/lib.module.js +1 -1
- package/dist/lib.module.js.map +1 -1
- package/dist/lib.web.js +173 -105
- package/dist/lib.web.js.map +1 -1
- package/dist/microsoft.cognitiveservices.speech.sdk-aac6c80f.js +2 -0
- package/dist/microsoft.cognitiveservices.speech.sdk-aac6c80f.js.map +1 -0
- package/dist/modules/microphone.d.ts.map +1 -1
- package/dist/modules/video.d.ts +3 -1
- package/dist/modules/video.d.ts.map +1 -1
- package/dist/modules/vp8.d.ts +0 -2
- package/dist/modules/vp8.d.ts.map +1 -1
- package/dist/types/Conversation.d.ts +1 -0
- package/dist/types/Conversation.d.ts.map +1 -1
- package/dist/types/event.d.ts +6 -4
- package/dist/types/event.d.ts.map +1 -1
- package/dist/types/microphone.d.ts +4 -0
- package/dist/types/microphone.d.ts.map +1 -1
- package/dist/utils/microphone.d.ts +2 -7
- package/dist/utils/microphone.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,6 +72,7 @@ const conversation = await Conversation.startDigitalHuman({
|
|
|
72
72
|
- **microphoneProvider** - Provider for the microphone - `"azure" | "eleven_labs"`
|
|
73
73
|
- **microphoneOptions** - Callbacks for microphone events
|
|
74
74
|
- **onMicrophoneSpeechRecognitionResult ({ transcript: string })** - Called when microphone recognizes your user's speech. This returns a transcript. Ideal behavior is to call the `.sendMessage` method with your transcript as microphone doesn't automatically commit / send users text to our AI.
|
|
75
|
+
- **onMicrophonePartialSpeechRecognitionResult ()** - Called when microphone recognizes that the user is trying to speak. This **doesn't** returns a transcript. Ideal behavior is to check if digital human is currently responding (`speaking`) and trigger the stop response method (`.stopResponse`).
|
|
75
76
|
- **onMicrophoneStatusChange ({status})** Called when microphone status changes
|
|
76
77
|
- **status** `"ON" | "OFF" | "PROCESSING"` Shows current status of microphone.
|
|
77
78
|
- **onMicrophoneError ({ message: string })** - Called when microphone has an error with the error message.
|
|
@@ -81,6 +82,7 @@ const conversation = await Conversation.startDigitalHuman({
|
|
|
81
82
|
- **vadThreshold `Number`**
|
|
82
83
|
- **minSpeechDurationMs `Number`**
|
|
83
84
|
- **minSilenceDurationMs `Number`**
|
|
85
|
+
- **disableDynamicSpeechRecognition `Boolean`** - This disables ElevenLabs dynamic speech recognition language detection and uses the language specified during digital human creation.
|
|
84
86
|
|
|
85
87
|
#### Callbacks
|
|
86
88
|
|
|
@@ -111,6 +113,8 @@ Register callbacks to handle various events:
|
|
|
111
113
|
- **onTimeoutWarning** - Called before the session times out. This event warns you that the customers session is going to end in a bit. You can call the `keepSession` method to extend the customers session.
|
|
112
114
|
- **onKeepSession** - Called when a keep-alive request is processed
|
|
113
115
|
- **onError** - Called when an error occurs
|
|
116
|
+
- **onStoppingStart** - Called immediately when a stop request is initiated
|
|
117
|
+
- **onStoppingEnd** - Called once the current response stops playing
|
|
114
118
|
|
|
115
119
|
### Getting Background Video
|
|
116
120
|
|
|
@@ -186,6 +190,17 @@ Get the current user's ID:
|
|
|
186
190
|
const userId = conversation.getUserId();
|
|
187
191
|
```
|
|
188
192
|
|
|
193
|
+
#### stopResponse()
|
|
194
|
+
|
|
195
|
+
Stops the ongoing response and notifies you via two callbacks:
|
|
196
|
+
|
|
197
|
+
- `onStoppingStart()` - Called immediately when stop is initiated.
|
|
198
|
+
- `onStoppingEnd()` - Called once the current response is stopped.
|
|
199
|
+
|
|
200
|
+
```js
|
|
201
|
+
await conversation.stopResponse();
|
|
202
|
+
```
|
|
203
|
+
|
|
189
204
|
#### endSession()
|
|
190
205
|
|
|
191
206
|
End the conversation session and clean up resources:
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare class Conversation {
|
|
|
29
29
|
private status;
|
|
30
30
|
protected volume: number;
|
|
31
31
|
private sessionStarted;
|
|
32
|
+
private isStoppingLastResponse;
|
|
32
33
|
private messageCounter;
|
|
33
34
|
private syncController;
|
|
34
35
|
private avController;
|
|
@@ -71,12 +72,11 @@ export declare class Conversation {
|
|
|
71
72
|
private handleEndSession;
|
|
72
73
|
private updateStatus;
|
|
73
74
|
/**
|
|
74
|
-
* To stop
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* 3. clear audio queue
|
|
78
|
-
* 4. send an event if all expected response from BE has been received. If not, FE will keep status in 'stopping' mode
|
|
75
|
+
* To stop streaming response, we'll send a stop message to the BE. The BE will then stop sending audio and video frames, which will naturally end the response. This is more efficient and leads to a better user experience as it allows for a smoother transition when stopping the response.
|
|
76
|
+
*
|
|
77
|
+
* To stop cached response, we just stop the video and fade to idle.
|
|
79
78
|
*/
|
|
79
|
+
stopResponse(): Promise<void>;
|
|
80
80
|
toggleMute(): Promise<number>;
|
|
81
81
|
startSession(): Promise<Connection>;
|
|
82
82
|
toggleMicrophone(): Promise<void>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAIjD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAElB,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAEhB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA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