@contentgrowth/llm-service 0.9.97 → 0.9.98
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.
|
@@ -300,6 +300,10 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
|
|
|
300
300
|
recognition.onend = () => {
|
|
301
301
|
console.log("[useSpeechRecognition] Native onend event fired. Timestamp:", Date.now());
|
|
302
302
|
isStartingRef.current = false;
|
|
303
|
+
if (recognitionRef.current === recognition) {
|
|
304
|
+
console.log("[useSpeechRecognition] Nullifying recognitionRef (onend)");
|
|
305
|
+
recognitionRef.current = null;
|
|
306
|
+
}
|
|
303
307
|
if (isSimulatingRef.current) {
|
|
304
308
|
console.log("[useSpeechRecognition] onend ignored - simulating");
|
|
305
309
|
return;
|
|
@@ -345,6 +349,10 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
|
|
|
345
349
|
} else if (event.error === "network") {
|
|
346
350
|
console.error("[useSpeechRecognition] - network: Network error during recognition");
|
|
347
351
|
}
|
|
352
|
+
if (recognitionRef.current === recognition) {
|
|
353
|
+
console.log("[useSpeechRecognition] Nullifying recognitionRef (onerror)");
|
|
354
|
+
recognitionRef.current = null;
|
|
355
|
+
}
|
|
348
356
|
isStartingRef.current = false;
|
|
349
357
|
if (event.error === "not-allowed" && process.env.NODE_ENV === "development") {
|
|
350
358
|
console.warn("Speech recognition blocked. Simulating input for development...");
|
|
@@ -405,6 +413,8 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
|
|
|
405
413
|
if (recognitionRef.current) {
|
|
406
414
|
console.log("[useSpeechRecognition] Stopping existing instance before creating new one");
|
|
407
415
|
try {
|
|
416
|
+
recognitionRef.current.onend = null;
|
|
417
|
+
recognitionRef.current.onerror = null;
|
|
408
418
|
recognitionRef.current.stop();
|
|
409
419
|
} catch (e) {
|
|
410
420
|
}
|
|
@@ -1106,10 +1116,6 @@ var TapToTalk = ({
|
|
|
1106
1116
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
1107
1117
|
}, []);
|
|
1108
1118
|
const toggleVoice = async (e) => {
|
|
1109
|
-
if (e) {
|
|
1110
|
-
e.preventDefault();
|
|
1111
|
-
e.stopPropagation();
|
|
1112
|
-
}
|
|
1113
1119
|
const now = Date.now();
|
|
1114
1120
|
if (now - tapCountRef.current.lastTap < 500) {
|
|
1115
1121
|
tapCountRef.current.count++;
|
|
@@ -1223,6 +1229,7 @@ var TapToTalk = ({
|
|
|
1223
1229
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1224
1230
|
"button",
|
|
1225
1231
|
{
|
|
1232
|
+
type: "button",
|
|
1226
1233
|
onClick: toggleVoice,
|
|
1227
1234
|
disabled: disabled || isTranscribing && !isListening,
|
|
1228
1235
|
className: `flex items-center justify-center gap-3 px-6 py-3 rounded-xl transition-all duration-300 w-full font-medium shadow-md active:scale-[0.98]
|
|
@@ -1231,9 +1238,9 @@ var TapToTalk = ({
|
|
|
1231
1238
|
${className}`,
|
|
1232
1239
|
title: label,
|
|
1233
1240
|
children: [
|
|
1234
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-center shrink-0", children: Icon }),
|
|
1235
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "truncate", children: label }),
|
|
1236
|
-
errorMsg && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-[10px] bg-white/20 px-1.5 py-0.5 rounded text-red-100 animate-in fade-in slide-in-from-right-1", children: errorMsg })
|
|
1241
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-center shrink-0 pointer-events-none", children: Icon }),
|
|
1242
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "truncate pointer-events-none", children: label }),
|
|
1243
|
+
errorMsg && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-[10px] bg-white/20 px-1.5 py-0.5 rounded text-red-100 animate-in fade-in slide-in-from-right-1 pointer-events-none", children: errorMsg })
|
|
1237
1244
|
]
|
|
1238
1245
|
}
|
|
1239
1246
|
)
|