@eshal-bot/chat-widget 0.2.46 → 0.2.48
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/{chat-widget-MarkdownRenderer-B1kp67-G.esm.js → chat-widget-MarkdownRenderer-DIcPzPvl.esm.js} +1 -1
- package/dist/{chat-widget-index-BVHEE7tJ.esm.js → chat-widget-index-DhXcfBZg.esm.js} +4 -4
- package/dist/chat-widget.esm.js +1 -1
- package/dist/chat-widget.js +31 -7
- package/dist/chat-widget.min.js +4 -4
- package/dist/chat-widget.umd.js +8 -8
- package/package.json +1 -1
package/dist/chat-widget.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{S as default}from"./chat-widget-index-
|
|
1
|
+
export{S as default}from"./chat-widget-index-DhXcfBZg.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
|
package/dist/chat-widget.js
CHANGED
|
@@ -9210,6 +9210,20 @@
|
|
|
9210
9210
|
*/
|
|
9211
9211
|
const BARGE_IN_RESUME_AFTER_MS = 4000;
|
|
9212
9212
|
|
|
9213
|
+
/**
|
|
9214
|
+
* Whether a sound the speech gate hears pauses what is playing. Not the
|
|
9215
|
+
* greeting: at call start the speakers' echo opens the gate before echo
|
|
9216
|
+
* cancellation settles, and the greeting sat paused waiting for the server's
|
|
9217
|
+
* verdict. Dev, 11 Nov 2026: 2 of 8 preview calls paused it about 1 s in with
|
|
9218
|
+
* no one speaking, and a caller took the pause for their turn. The server
|
|
9219
|
+
* still stops the greeting on the caller's real words (`interrupted`) and
|
|
9220
|
+
* ignores its own echo (voice-runtime barge_in.py).
|
|
9221
|
+
* Mirrors packages/frontend/src/lib/audio/bargeIn.ts.
|
|
9222
|
+
*/
|
|
9223
|
+
function pausesForSound(greetingPlaying) {
|
|
9224
|
+
return !greetingPlaying;
|
|
9225
|
+
}
|
|
9226
|
+
|
|
9213
9227
|
/** "resume" | "discard" | null (the event says nothing about the sound). */
|
|
9214
9228
|
function bargeInVerdict(event) {
|
|
9215
9229
|
if (!event) return null;
|
|
@@ -12670,9 +12684,16 @@
|
|
|
12670
12684
|
* - The static welcome this call added (`welcomeId`) is replaced by the
|
|
12671
12685
|
* greeting, so the call does not show both.
|
|
12672
12686
|
* - A bubble already on screen with the same text (a welcome shown before the
|
|
12673
|
-
* call started, in either list) is kept and no duplicate is added.
|
|
12687
|
+
* call started, in either list) is kept and no duplicate is added. "The
|
|
12688
|
+
* same" ignores case, spacing and curly or straight quotes: the welcome on
|
|
12689
|
+
* screen and the spoken one can differ only in those (dev, 11 Nov 2026,
|
|
12690
|
+
* the greeting showed twice).
|
|
12674
12691
|
* - Otherwise the greeting is appended as the bot's bubble.
|
|
12675
12692
|
*/
|
|
12693
|
+
function sameGreeting(a, b) {
|
|
12694
|
+
const norm = s => String(s).replace(/[‘’ʼ]/g, "'").replace(/[“”]/g, '"').replace(/\s+/g, " ").trim().toLowerCase();
|
|
12695
|
+
return norm(a) === norm(b);
|
|
12696
|
+
}
|
|
12676
12697
|
function applyVoiceGreeting(prev, text, welcomeId, others, makeBubble) {
|
|
12677
12698
|
if (welcomeId) {
|
|
12678
12699
|
const at = prev.findIndex(m => m.id === welcomeId);
|
|
@@ -12685,7 +12706,7 @@
|
|
|
12685
12706
|
return next;
|
|
12686
12707
|
}
|
|
12687
12708
|
}
|
|
12688
|
-
const shown = [...prev, ...(others || [])].some(m => m.role === "assistant" && typeof m.content === "string" && m.content
|
|
12709
|
+
const shown = [...prev, ...(others || [])].some(m => m.role === "assistant" && typeof m.content === "string" && sameGreeting(m.content, text));
|
|
12689
12710
|
if (shown) return prev;
|
|
12690
12711
|
return [...prev, makeBubble(text)];
|
|
12691
12712
|
}
|
|
@@ -15867,10 +15888,13 @@
|
|
|
15867
15888
|
// then resumes the audio or drops it (lib/audio/bargeIn.js): emptying
|
|
15868
15889
|
// the player here lost the rest of a reply to a cough (dev, 16 Oct).
|
|
15869
15890
|
onSpeechStart: () => {
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
15891
|
+
// The greeting plays on over a sound (lib/audio/bargeIn.js).
|
|
15892
|
+
if (pausesForSound(greetingActiveRef.current && !userHasSpokenRef.current)) {
|
|
15893
|
+
audioPlayerNodeRef.current?.port.postMessage({
|
|
15894
|
+
command: "pause"
|
|
15895
|
+
});
|
|
15896
|
+
bargeInPendingRef.current = true;
|
|
15897
|
+
}
|
|
15874
15898
|
if (bargeInTimerRef.current) clearTimeout(bargeInTimerRef.current);
|
|
15875
15899
|
bargeInTimerRef.current = null;
|
|
15876
15900
|
const ws = websocketRef.current;
|
|
@@ -23944,7 +23968,7 @@
|
|
|
23944
23968
|
* value by its own test (that constant sat at 0.1.113 while this package was
|
|
23945
23969
|
* at 0.2.2 precisely because nothing enforced it - EV-2431).
|
|
23946
23970
|
*/
|
|
23947
|
-
const WIDGET_VERSION = '0.2.
|
|
23971
|
+
const WIDGET_VERSION = '0.2.48';
|
|
23948
23972
|
|
|
23949
23973
|
/**
|
|
23950
23974
|
* API utility functions
|