@contentgrowth/llm-service 0.9.94 → 0.9.95

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.
@@ -720,6 +720,13 @@ var ChatInputArea = forwardRef(({
720
720
  var _a2, _b2;
721
721
  console.log("[ChatInputArea] startRecording called. trigger:", trigger, "isMobile:", isMobile());
722
722
  console.log("[ChatInputArea] Current state - voiceTrigger:", voiceTrigger, "isTranscribing:", isTranscribing);
723
+ if (isMobile()) {
724
+ console.log("[ChatInputArea] SKIPPING textarea focus on mobile to prevent keyboard conflict");
725
+ if (document.activeElement instanceof HTMLElement) {
726
+ console.log("[ChatInputArea] Blur active element on mobile BEFORE start");
727
+ document.activeElement.blur();
728
+ }
729
+ }
723
730
  if (voiceTrigger || isTranscribing) {
724
731
  console.log("[ChatInputArea] startRecording ignored - already active");
725
732
  return;
@@ -762,12 +769,6 @@ var ChatInputArea = forwardRef(({
762
769
  var _a3;
763
770
  return (_a3 = textareaRef.current) == null ? void 0 : _a3.focus();
764
771
  }, 0);
765
- } else {
766
- console.log("[ChatInputArea] SKIPPING textarea focus on mobile to prevent keyboard conflict");
767
- if (document.activeElement instanceof HTMLElement) {
768
- console.log("[ChatInputArea] Blur active element on mobile");
769
- document.activeElement.blur();
770
- }
771
772
  }
772
773
  };
773
774
  const stopRecording = () => {
@@ -1066,6 +1067,24 @@ var TapToTalk = ({
1066
1067
  e.preventDefault();
1067
1068
  e.stopPropagation();
1068
1069
  }
1070
+ const now = Date.now();
1071
+ if (now - tapCountRef.current.lastTap < 500) {
1072
+ tapCountRef.current.count++;
1073
+ } else {
1074
+ tapCountRef.current.count = 1;
1075
+ }
1076
+ tapCountRef.current.lastTap = now;
1077
+ if (tapCountRef.current.count >= 5) {
1078
+ setShowDebug((prev) => !prev);
1079
+ tapCountRef.current.count = 0;
1080
+ if (isActive) {
1081
+ console.log("[TapToTalk] Debug trigger force-stop");
1082
+ if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") nativeSpeech.stop();
1083
+ else customRecorder.stop();
1084
+ setVoiceTrigger(null);
1085
+ }
1086
+ return;
1087
+ }
1069
1088
  console.log("[TapToTalk] toggleVoice called. isMobile:", isMobile());
1070
1089
  if (processingRef.current) {
1071
1090
  console.log("[TapToTalk] toggleVoice ignored - processing");
@@ -1074,24 +1093,6 @@ var TapToTalk = ({
1074
1093
  processingRef.current = true;
1075
1094
  console.log("[TapToTalk] toggleVoice called. isActive:", isActive, "isListening:", isListening, "isTranscribing:", isTranscribing);
1076
1095
  try {
1077
- const now = Date.now();
1078
- if (now - tapCountRef.current.lastTap < 500) {
1079
- tapCountRef.current.count++;
1080
- } else {
1081
- tapCountRef.current.count = 1;
1082
- }
1083
- tapCountRef.current.lastTap = now;
1084
- if (tapCountRef.current.count >= 5) {
1085
- setShowDebug((prev) => !prev);
1086
- tapCountRef.current.count = 0;
1087
- if (isActive) {
1088
- console.log("[TapToTalk] Debug trigger force-stop");
1089
- if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") nativeSpeech.stop();
1090
- else customRecorder.stop();
1091
- setVoiceTrigger(null);
1092
- }
1093
- return;
1094
- }
1095
1096
  if (isActive) {
1096
1097
  if (isTranscribing && !isListening) {
1097
1098
  console.log("[TapToTalk] Ignoring click during transcription");
@@ -1107,17 +1108,14 @@ var TapToTalk = ({
1107
1108
  } else {
1108
1109
  console.log("[TapToTalk] Starting voice... mode:", voiceConfig == null ? void 0 : voiceConfig.mode);
1109
1110
  setErrorMsg(null);
1110
- if (onFocusTarget && !isMobile()) {
1111
- console.log("[TapToTalk] calling onFocusTarget() (desktop only)");
1112
- onFocusTarget();
1113
- } else {
1114
- if (onFocusTarget) {
1115
- console.log("[TapToTalk] SKIPPING onFocusTarget on mobile to prevent keyboard conflict");
1116
- }
1117
- if (isMobile() && document.activeElement instanceof HTMLElement) {
1118
- console.log("[TapToTalk] Blurring active element on mobile");
1111
+ if (isMobile()) {
1112
+ console.log("[TapToTalk] Mobile: Blurring active element and skipping onFocusTarget");
1113
+ if (document.activeElement instanceof HTMLElement) {
1119
1114
  document.activeElement.blur();
1120
1115
  }
1116
+ } else if (onFocusTarget) {
1117
+ console.log("[TapToTalk] Desktop: calling onFocusTarget()");
1118
+ onFocusTarget();
1121
1119
  }
1122
1120
  setVoiceTrigger("click");
1123
1121
  console.log("[TapToTalk] voiceTrigger set to click");