@contentgrowth/llm-service 0.9.7 → 0.9.8

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.
@@ -218,10 +218,12 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
218
218
  recognition.continuous = true;
219
219
  recognition.interimResults = true;
220
220
  recognition.onstart = () => {
221
+ console.log("[useSpeechRecognition] Native onstart event fired");
221
222
  setIsListening(true);
222
223
  setError(null);
223
224
  };
224
225
  recognition.onend = () => {
226
+ console.log("[useSpeechRecognition] Native onend event fired");
225
227
  if (isSimulatingRef.current) {
226
228
  return;
227
229
  }
@@ -269,6 +271,7 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
269
271
  }
270
272
  }
271
273
  return () => {
274
+ console.log("[useSpeechRecognition] Effect cleanup - stopping recognition");
272
275
  if (isSimulatingRef.current && simulationTimeoutRef.current) {
273
276
  clearTimeout(simulationTimeoutRef.current);
274
277
  simulationTimeoutRef.current = null;
@@ -280,21 +283,27 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
280
283
  }, []);
281
284
  (0, import_react2.useEffect)(() => {
282
285
  if (recognitionRef.current) {
286
+ console.log("[useSpeechRecognition] Updating language to:", language);
283
287
  recognitionRef.current.lang = language;
284
288
  }
285
289
  }, [language]);
286
290
  const start = (0, import_react2.useCallback)(() => {
287
- if (recognitionRef.current && !isListening) {
288
- try {
289
- setTranscript("");
290
- recognitionRef.current.start();
291
- } catch (e) {
292
- console.error("[useSpeechRecognition] Failed to start speech recognition:", e);
293
- }
294
- } else {
291
+ console.log("[useSpeechRecognition] start() called");
292
+ if (isSimulatingRef.current) return;
293
+ if (!recognitionRef.current) {
294
+ console.error("[useSpeechRecognition] Recognition instance missing");
295
+ return;
296
+ }
297
+ try {
298
+ setTranscript("");
299
+ recognitionRef.current.start();
300
+ console.log("[useSpeechRecognition] recognition.start() executed");
301
+ } catch (error2) {
302
+ console.error("[useSpeechRecognition] Failed to start recognition:", error2);
295
303
  }
296
- }, [isListening]);
304
+ }, []);
297
305
  const stop = (0, import_react2.useCallback)(() => {
306
+ console.log("[useSpeechRecognition] stop() called");
298
307
  if (isSimulatingRef.current) {
299
308
  if (simulationTimeoutRef.current) {
300
309
  clearTimeout(simulationTimeoutRef.current);
@@ -308,11 +317,11 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
308
317
  if (onEndRef.current) onEndRef.current();
309
318
  return;
310
319
  }
311
- if (recognitionRef.current && isListening) {
320
+ if (recognitionRef.current) {
312
321
  recognitionRef.current.stop();
313
- } else {
322
+ console.log("[useSpeechRecognition] recognition.stop() executed");
314
323
  }
315
- }, [isListening, onResult, onEnd]);
324
+ }, []);
316
325
  const resetTranscript = (0, import_react2.useCallback)(() => {
317
326
  setTranscript("");
318
327
  }, []);
@@ -922,6 +931,7 @@ var TapToTalk = ({
922
931
  const isListening = !!voiceTrigger || nativeSpeech.isListening || customRecorder.isRecording;
923
932
  const isActive = isListening || isTranscribing;
924
933
  const toggleVoice = async () => {
934
+ console.log("[TapToTalk] toggleVoice called. isActive:", isActive);
925
935
  const now = Date.now();
926
936
  if (now - tapCountRef.current.lastTap < 500) {
927
937
  tapCountRef.current.count++;
@@ -933,6 +943,7 @@ var TapToTalk = ({
933
943
  setShowDebug((prev) => !prev);
934
944
  tapCountRef.current.count = 0;
935
945
  if (isActive) {
946
+ console.log("[TapToTalk] Debug trigger force-stop");
936
947
  if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") nativeSpeech.stop();
937
948
  else customRecorder.stop();
938
949
  setVoiceTrigger(null);
@@ -940,7 +951,11 @@ var TapToTalk = ({
940
951
  return;
941
952
  }
942
953
  if (isActive) {
943
- if (isTranscribing && !isListening) return;
954
+ if (isTranscribing && !isListening) {
955
+ console.log("[TapToTalk] Ignoring click during transcription");
956
+ return;
957
+ }
958
+ console.log("[TapToTalk] Stopping voice...");
944
959
  if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") {
945
960
  nativeSpeech.stop();
946
961
  } else {
@@ -948,6 +963,7 @@ var TapToTalk = ({
948
963
  }
949
964
  setVoiceTrigger(null);
950
965
  } else {
966
+ console.log("[TapToTalk] Starting voice...");
951
967
  setErrorMsg(null);
952
968
  onFocusTarget == null ? void 0 : onFocusTarget();
953
969
  setVoiceTrigger("click");