@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.
@@ -176,10 +176,12 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
176
176
  recognition.continuous = true;
177
177
  recognition.interimResults = true;
178
178
  recognition.onstart = () => {
179
+ console.log("[useSpeechRecognition] Native onstart event fired");
179
180
  setIsListening(true);
180
181
  setError(null);
181
182
  };
182
183
  recognition.onend = () => {
184
+ console.log("[useSpeechRecognition] Native onend event fired");
183
185
  if (isSimulatingRef.current) {
184
186
  return;
185
187
  }
@@ -227,6 +229,7 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
227
229
  }
228
230
  }
229
231
  return () => {
232
+ console.log("[useSpeechRecognition] Effect cleanup - stopping recognition");
230
233
  if (isSimulatingRef.current && simulationTimeoutRef.current) {
231
234
  clearTimeout(simulationTimeoutRef.current);
232
235
  simulationTimeoutRef.current = null;
@@ -238,21 +241,27 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
238
241
  }, []);
239
242
  useEffect(() => {
240
243
  if (recognitionRef.current) {
244
+ console.log("[useSpeechRecognition] Updating language to:", language);
241
245
  recognitionRef.current.lang = language;
242
246
  }
243
247
  }, [language]);
244
248
  const start = useCallback(() => {
245
- if (recognitionRef.current && !isListening) {
246
- try {
247
- setTranscript("");
248
- recognitionRef.current.start();
249
- } catch (e) {
250
- console.error("[useSpeechRecognition] Failed to start speech recognition:", e);
251
- }
252
- } else {
249
+ console.log("[useSpeechRecognition] start() called");
250
+ if (isSimulatingRef.current) return;
251
+ if (!recognitionRef.current) {
252
+ console.error("[useSpeechRecognition] Recognition instance missing");
253
+ return;
254
+ }
255
+ try {
256
+ setTranscript("");
257
+ recognitionRef.current.start();
258
+ console.log("[useSpeechRecognition] recognition.start() executed");
259
+ } catch (error2) {
260
+ console.error("[useSpeechRecognition] Failed to start recognition:", error2);
253
261
  }
254
- }, [isListening]);
262
+ }, []);
255
263
  const stop = useCallback(() => {
264
+ console.log("[useSpeechRecognition] stop() called");
256
265
  if (isSimulatingRef.current) {
257
266
  if (simulationTimeoutRef.current) {
258
267
  clearTimeout(simulationTimeoutRef.current);
@@ -266,11 +275,11 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
266
275
  if (onEndRef.current) onEndRef.current();
267
276
  return;
268
277
  }
269
- if (recognitionRef.current && isListening) {
278
+ if (recognitionRef.current) {
270
279
  recognitionRef.current.stop();
271
- } else {
280
+ console.log("[useSpeechRecognition] recognition.stop() executed");
272
281
  }
273
- }, [isListening, onResult, onEnd]);
282
+ }, []);
274
283
  const resetTranscript = useCallback(() => {
275
284
  setTranscript("");
276
285
  }, []);
@@ -880,6 +889,7 @@ var TapToTalk = ({
880
889
  const isListening = !!voiceTrigger || nativeSpeech.isListening || customRecorder.isRecording;
881
890
  const isActive = isListening || isTranscribing;
882
891
  const toggleVoice = async () => {
892
+ console.log("[TapToTalk] toggleVoice called. isActive:", isActive);
883
893
  const now = Date.now();
884
894
  if (now - tapCountRef.current.lastTap < 500) {
885
895
  tapCountRef.current.count++;
@@ -891,6 +901,7 @@ var TapToTalk = ({
891
901
  setShowDebug((prev) => !prev);
892
902
  tapCountRef.current.count = 0;
893
903
  if (isActive) {
904
+ console.log("[TapToTalk] Debug trigger force-stop");
894
905
  if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") nativeSpeech.stop();
895
906
  else customRecorder.stop();
896
907
  setVoiceTrigger(null);
@@ -898,7 +909,11 @@ var TapToTalk = ({
898
909
  return;
899
910
  }
900
911
  if (isActive) {
901
- if (isTranscribing && !isListening) return;
912
+ if (isTranscribing && !isListening) {
913
+ console.log("[TapToTalk] Ignoring click during transcription");
914
+ return;
915
+ }
916
+ console.log("[TapToTalk] Stopping voice...");
902
917
  if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") {
903
918
  nativeSpeech.stop();
904
919
  } else {
@@ -906,6 +921,7 @@ var TapToTalk = ({
906
921
  }
907
922
  setVoiceTrigger(null);
908
923
  } else {
924
+ console.log("[TapToTalk] Starting voice...");
909
925
  setErrorMsg(null);
910
926
  onFocusTarget == null ? void 0 : onFocusTarget();
911
927
  setVoiceTrigger("click");