@contentgrowth/llm-service 0.9.93 → 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.
|
@@ -717,17 +717,22 @@ var ChatInputArea = forwardRef(({
|
|
|
717
717
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
718
718
|
}, []);
|
|
719
719
|
const startRecording = async (trigger) => {
|
|
720
|
-
var _a2;
|
|
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;
|
|
726
733
|
}
|
|
727
734
|
setVoiceTrigger(trigger);
|
|
728
735
|
setVoiceError(null);
|
|
729
|
-
console.log("[ChatInputArea] Calling voiceConfig.onVoiceStart if exists...");
|
|
730
|
-
(_a2 = voiceConfig == null ? void 0 : voiceConfig.onVoiceStart) == null ? void 0 : _a2.call(voiceConfig);
|
|
731
736
|
if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") {
|
|
732
737
|
console.log("[ChatInputArea] Using native speech recognition");
|
|
733
738
|
if (!nativeSpeech.isSupported) {
|
|
@@ -739,8 +744,22 @@ var ChatInputArea = forwardRef(({
|
|
|
739
744
|
console.log("[ChatInputArea] Calling nativeSpeech.start()...");
|
|
740
745
|
nativeSpeech.start();
|
|
741
746
|
console.log("[ChatInputArea] nativeSpeech.start() called");
|
|
747
|
+
console.log("[ChatInputArea] Calling voiceConfig.onVoiceStart if exists (after nativeSpeech.start)...");
|
|
748
|
+
try {
|
|
749
|
+
(_a2 = voiceConfig == null ? void 0 : voiceConfig.onVoiceStart) == null ? void 0 : _a2.call(voiceConfig);
|
|
750
|
+
console.log("[ChatInputArea] voiceConfig.onVoiceStart completed");
|
|
751
|
+
} catch (e) {
|
|
752
|
+
console.error("[ChatInputArea] voiceConfig.onVoiceStart threw error", e);
|
|
753
|
+
}
|
|
742
754
|
} else {
|
|
743
755
|
console.log("[ChatInputArea] Using custom recorder");
|
|
756
|
+
console.log("[ChatInputArea] Calling voiceConfig.onVoiceStart if exists (custom mode)...");
|
|
757
|
+
try {
|
|
758
|
+
(_b2 = voiceConfig == null ? void 0 : voiceConfig.onVoiceStart) == null ? void 0 : _b2.call(voiceConfig);
|
|
759
|
+
console.log("[ChatInputArea] voiceConfig.onVoiceStart completed");
|
|
760
|
+
} catch (e) {
|
|
761
|
+
console.error("[ChatInputArea] voiceConfig.onVoiceStart threw error", e);
|
|
762
|
+
}
|
|
744
763
|
await customRecorder.start();
|
|
745
764
|
console.log("[ChatInputArea] Custom recorder started");
|
|
746
765
|
}
|
|
@@ -750,8 +769,6 @@ var ChatInputArea = forwardRef(({
|
|
|
750
769
|
var _a3;
|
|
751
770
|
return (_a3 = textareaRef.current) == null ? void 0 : _a3.focus();
|
|
752
771
|
}, 0);
|
|
753
|
-
} else {
|
|
754
|
-
console.log("[ChatInputArea] SKIPPING textarea focus on mobile to prevent keyboard conflict");
|
|
755
772
|
}
|
|
756
773
|
};
|
|
757
774
|
const stopRecording = () => {
|
|
@@ -1050,6 +1067,24 @@ var TapToTalk = ({
|
|
|
1050
1067
|
e.preventDefault();
|
|
1051
1068
|
e.stopPropagation();
|
|
1052
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
|
+
}
|
|
1053
1088
|
console.log("[TapToTalk] toggleVoice called. isMobile:", isMobile());
|
|
1054
1089
|
if (processingRef.current) {
|
|
1055
1090
|
console.log("[TapToTalk] toggleVoice ignored - processing");
|
|
@@ -1058,24 +1093,6 @@ var TapToTalk = ({
|
|
|
1058
1093
|
processingRef.current = true;
|
|
1059
1094
|
console.log("[TapToTalk] toggleVoice called. isActive:", isActive, "isListening:", isListening, "isTranscribing:", isTranscribing);
|
|
1060
1095
|
try {
|
|
1061
|
-
const now = Date.now();
|
|
1062
|
-
if (now - tapCountRef.current.lastTap < 500) {
|
|
1063
|
-
tapCountRef.current.count++;
|
|
1064
|
-
} else {
|
|
1065
|
-
tapCountRef.current.count = 1;
|
|
1066
|
-
}
|
|
1067
|
-
tapCountRef.current.lastTap = now;
|
|
1068
|
-
if (tapCountRef.current.count >= 5) {
|
|
1069
|
-
setShowDebug((prev) => !prev);
|
|
1070
|
-
tapCountRef.current.count = 0;
|
|
1071
|
-
if (isActive) {
|
|
1072
|
-
console.log("[TapToTalk] Debug trigger force-stop");
|
|
1073
|
-
if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") nativeSpeech.stop();
|
|
1074
|
-
else customRecorder.stop();
|
|
1075
|
-
setVoiceTrigger(null);
|
|
1076
|
-
}
|
|
1077
|
-
return;
|
|
1078
|
-
}
|
|
1079
1096
|
if (isActive) {
|
|
1080
1097
|
if (isTranscribing && !isListening) {
|
|
1081
1098
|
console.log("[TapToTalk] Ignoring click during transcription");
|
|
@@ -1091,13 +1108,14 @@ var TapToTalk = ({
|
|
|
1091
1108
|
} else {
|
|
1092
1109
|
console.log("[TapToTalk] Starting voice... mode:", voiceConfig == null ? void 0 : voiceConfig.mode);
|
|
1093
1110
|
setErrorMsg(null);
|
|
1094
|
-
if (
|
|
1095
|
-
console.log("[TapToTalk]
|
|
1096
|
-
|
|
1111
|
+
if (isMobile()) {
|
|
1112
|
+
console.log("[TapToTalk] Mobile: Blurring active element and skipping onFocusTarget");
|
|
1113
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
1114
|
+
document.activeElement.blur();
|
|
1115
|
+
}
|
|
1097
1116
|
} else if (onFocusTarget) {
|
|
1098
|
-
console.log("[TapToTalk]
|
|
1099
|
-
|
|
1100
|
-
console.log("[TapToTalk] onFocusTarget is undefined");
|
|
1117
|
+
console.log("[TapToTalk] Desktop: calling onFocusTarget()");
|
|
1118
|
+
onFocusTarget();
|
|
1101
1119
|
}
|
|
1102
1120
|
setVoiceTrigger("click");
|
|
1103
1121
|
console.log("[TapToTalk] voiceTrigger set to click");
|