@crestapps/ai-chat-ui 2.0.0-preview.193 → 2.0.0-preview.197
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/dist/ai-chat.js +77 -20
- package/dist/ai-chat.js.map +1 -1
- package/dist/ai-chat.min.js +1 -1
- package/dist/ai-chat.min.js.map +1 -1
- package/dist/chat-interaction.js +109 -17
- package/dist/chat-interaction.js.map +1 -1
- package/dist/chat-interaction.min.js +1 -1
- package/dist/chat-interaction.min.js.map +1 -1
- package/dist/realtime-audio.js +16 -2
- package/dist/realtime-audio.js.map +1 -1
- package/dist/realtime-audio.min.js +1 -1
- package/dist/realtime-audio.min.js.map +1 -1
- package/package.json +1 -1
package/dist/realtime-audio.js
CHANGED
|
@@ -687,6 +687,12 @@
|
|
|
687
687
|
var noop = function noop() {};
|
|
688
688
|
var onActivate = opts.onActivate || noop;
|
|
689
689
|
var onDeactivate = opts.onDeactivate || noop;
|
|
690
|
+
// Reports whether a session is live, every time the button is repainted, so a host that shows or hides
|
|
691
|
+
// controls around the session reads the same flag the button does. onActivate/onDeactivate are events
|
|
692
|
+
// and can be missed -- the transport fallback deactivates WebRTC and activates the WebSocket without
|
|
693
|
+
// pairing them -- which left a host tracking the session itself able to drift out of step with the
|
|
694
|
+
// button, showing "Start speaking" over a message box that was still hidden.
|
|
695
|
+
var onSessionStateChanged = opts.onSessionStateChanged || noop;
|
|
690
696
|
var onEnterRealtimeMode = opts.onEnterRealtimeMode || noop;
|
|
691
697
|
// The server tells us a user utterance was captured before it has been transcribed, so the host can show a
|
|
692
698
|
// placeholder in the right position; onUserTurnDropped removes it when the utterance produced nothing.
|
|
@@ -792,7 +798,11 @@
|
|
|
792
798
|
realtimeMicDeviceId = '',
|
|
793
799
|
realtimeOutputDeviceId = '',
|
|
794
800
|
realtimeLanguage = '',
|
|
795
|
-
realtimeAudioSettingsBuilt = false
|
|
801
|
+
realtimeAudioSettingsBuilt = false,
|
|
802
|
+
// The settings popover this instance built. A page can host two chat clients at once -- its own chat
|
|
803
|
+
// and the admin widget -- and both popovers carry the same element id, so looking one up by id would
|
|
804
|
+
// hand the second instance the first one's popover.
|
|
805
|
+
realtimeAudioSettingsElement = null;
|
|
796
806
|
|
|
797
807
|
// The half-duplex echo tail on the WebSocket transport: how long the microphone stays muted after the
|
|
798
808
|
// scheduled end of the assistant's playback, covering the room's reverberation.
|
|
@@ -1023,6 +1033,7 @@
|
|
|
1023
1033
|
wrap.appendChild(gear);
|
|
1024
1034
|
wrap.appendChild(panel);
|
|
1025
1035
|
realtimeBtn.insertAdjacentElement('afterend', wrap);
|
|
1036
|
+
realtimeAudioSettingsElement = wrap;
|
|
1026
1037
|
var bargeInput = panel.querySelector('.js-barge');
|
|
1027
1038
|
var pttInput = panel.querySelector('.js-ptt');
|
|
1028
1039
|
var volInput = panel.querySelector('.js-vol');
|
|
@@ -1192,6 +1203,9 @@
|
|
|
1192
1203
|
button.replaceChildren(document.createTextNode(text));
|
|
1193
1204
|
}
|
|
1194
1205
|
function updateRealtimeButton() {
|
|
1206
|
+
// Reported before the early return: a host still has to be told the session ended even on a surface
|
|
1207
|
+
// that never rendered the button.
|
|
1208
|
+
onSessionStateChanged(isRealtimeActive);
|
|
1195
1209
|
var realtimeBtn = q('realtimeButton');
|
|
1196
1210
|
if (!realtimeBtn) {
|
|
1197
1211
|
return;
|
|
@@ -1219,7 +1233,7 @@
|
|
|
1219
1233
|
var conversationBtn = q('conversationButton');
|
|
1220
1234
|
var inputEl = q('input');
|
|
1221
1235
|
var sendBtn = q('sendButton');
|
|
1222
|
-
var audioSettings =
|
|
1236
|
+
var audioSettings = realtimeAudioSettingsElement;
|
|
1223
1237
|
if (enable) {
|
|
1224
1238
|
onEnterRealtimeMode();
|
|
1225
1239
|
if (inputEl) {
|