@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.
|
@@ -759,17 +759,22 @@ var ChatInputArea = (0, import_react5.forwardRef)(({
|
|
|
759
759
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
760
760
|
}, []);
|
|
761
761
|
const startRecording = async (trigger) => {
|
|
762
|
-
var _a2;
|
|
762
|
+
var _a2, _b2;
|
|
763
763
|
console.log("[ChatInputArea] startRecording called. trigger:", trigger, "isMobile:", isMobile());
|
|
764
764
|
console.log("[ChatInputArea] Current state - voiceTrigger:", voiceTrigger, "isTranscribing:", isTranscribing);
|
|
765
|
+
if (isMobile()) {
|
|
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 BEFORE start");
|
|
769
|
+
document.activeElement.blur();
|
|
770
|
+
}
|
|
771
|
+
}
|
|
765
772
|
if (voiceTrigger || isTranscribing) {
|
|
766
773
|
console.log("[ChatInputArea] startRecording ignored - already active");
|
|
767
774
|
return;
|
|
768
775
|
}
|
|
769
776
|
setVoiceTrigger(trigger);
|
|
770
777
|
setVoiceError(null);
|
|
771
|
-
console.log("[ChatInputArea] Calling voiceConfig.onVoiceStart if exists...");
|
|
772
|
-
(_a2 = voiceConfig == null ? void 0 : voiceConfig.onVoiceStart) == null ? void 0 : _a2.call(voiceConfig);
|
|
773
778
|
if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") {
|
|
774
779
|
console.log("[ChatInputArea] Using native speech recognition");
|
|
775
780
|
if (!nativeSpeech.isSupported) {
|
|
@@ -781,8 +786,22 @@ var ChatInputArea = (0, import_react5.forwardRef)(({
|
|
|
781
786
|
console.log("[ChatInputArea] Calling nativeSpeech.start()...");
|
|
782
787
|
nativeSpeech.start();
|
|
783
788
|
console.log("[ChatInputArea] nativeSpeech.start() called");
|
|
789
|
+
console.log("[ChatInputArea] Calling voiceConfig.onVoiceStart if exists (after nativeSpeech.start)...");
|
|
790
|
+
try {
|
|
791
|
+
(_a2 = voiceConfig == null ? void 0 : voiceConfig.onVoiceStart) == null ? void 0 : _a2.call(voiceConfig);
|
|
792
|
+
console.log("[ChatInputArea] voiceConfig.onVoiceStart completed");
|
|
793
|
+
} catch (e) {
|
|
794
|
+
console.error("[ChatInputArea] voiceConfig.onVoiceStart threw error", e);
|
|
795
|
+
}
|
|
784
796
|
} else {
|
|
785
797
|
console.log("[ChatInputArea] Using custom recorder");
|
|
798
|
+
console.log("[ChatInputArea] Calling voiceConfig.onVoiceStart if exists (custom mode)...");
|
|
799
|
+
try {
|
|
800
|
+
(_b2 = voiceConfig == null ? void 0 : voiceConfig.onVoiceStart) == null ? void 0 : _b2.call(voiceConfig);
|
|
801
|
+
console.log("[ChatInputArea] voiceConfig.onVoiceStart completed");
|
|
802
|
+
} catch (e) {
|
|
803
|
+
console.error("[ChatInputArea] voiceConfig.onVoiceStart threw error", e);
|
|
804
|
+
}
|
|
786
805
|
await customRecorder.start();
|
|
787
806
|
console.log("[ChatInputArea] Custom recorder started");
|
|
788
807
|
}
|
|
@@ -792,8 +811,6 @@ var ChatInputArea = (0, import_react5.forwardRef)(({
|
|
|
792
811
|
var _a3;
|
|
793
812
|
return (_a3 = textareaRef.current) == null ? void 0 : _a3.focus();
|
|
794
813
|
}, 0);
|
|
795
|
-
} else {
|
|
796
|
-
console.log("[ChatInputArea] SKIPPING textarea focus on mobile to prevent keyboard conflict");
|
|
797
814
|
}
|
|
798
815
|
};
|
|
799
816
|
const stopRecording = () => {
|
|
@@ -1092,6 +1109,24 @@ var TapToTalk = ({
|
|
|
1092
1109
|
e.preventDefault();
|
|
1093
1110
|
e.stopPropagation();
|
|
1094
1111
|
}
|
|
1112
|
+
const now = Date.now();
|
|
1113
|
+
if (now - tapCountRef.current.lastTap < 500) {
|
|
1114
|
+
tapCountRef.current.count++;
|
|
1115
|
+
} else {
|
|
1116
|
+
tapCountRef.current.count = 1;
|
|
1117
|
+
}
|
|
1118
|
+
tapCountRef.current.lastTap = now;
|
|
1119
|
+
if (tapCountRef.current.count >= 5) {
|
|
1120
|
+
setShowDebug((prev) => !prev);
|
|
1121
|
+
tapCountRef.current.count = 0;
|
|
1122
|
+
if (isActive) {
|
|
1123
|
+
console.log("[TapToTalk] Debug trigger force-stop");
|
|
1124
|
+
if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") nativeSpeech.stop();
|
|
1125
|
+
else customRecorder.stop();
|
|
1126
|
+
setVoiceTrigger(null);
|
|
1127
|
+
}
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1095
1130
|
console.log("[TapToTalk] toggleVoice called. isMobile:", isMobile());
|
|
1096
1131
|
if (processingRef.current) {
|
|
1097
1132
|
console.log("[TapToTalk] toggleVoice ignored - processing");
|
|
@@ -1100,24 +1135,6 @@ var TapToTalk = ({
|
|
|
1100
1135
|
processingRef.current = true;
|
|
1101
1136
|
console.log("[TapToTalk] toggleVoice called. isActive:", isActive, "isListening:", isListening, "isTranscribing:", isTranscribing);
|
|
1102
1137
|
try {
|
|
1103
|
-
const now = Date.now();
|
|
1104
|
-
if (now - tapCountRef.current.lastTap < 500) {
|
|
1105
|
-
tapCountRef.current.count++;
|
|
1106
|
-
} else {
|
|
1107
|
-
tapCountRef.current.count = 1;
|
|
1108
|
-
}
|
|
1109
|
-
tapCountRef.current.lastTap = now;
|
|
1110
|
-
if (tapCountRef.current.count >= 5) {
|
|
1111
|
-
setShowDebug((prev) => !prev);
|
|
1112
|
-
tapCountRef.current.count = 0;
|
|
1113
|
-
if (isActive) {
|
|
1114
|
-
console.log("[TapToTalk] Debug trigger force-stop");
|
|
1115
|
-
if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") nativeSpeech.stop();
|
|
1116
|
-
else customRecorder.stop();
|
|
1117
|
-
setVoiceTrigger(null);
|
|
1118
|
-
}
|
|
1119
|
-
return;
|
|
1120
|
-
}
|
|
1121
1138
|
if (isActive) {
|
|
1122
1139
|
if (isTranscribing && !isListening) {
|
|
1123
1140
|
console.log("[TapToTalk] Ignoring click during transcription");
|
|
@@ -1133,13 +1150,14 @@ var TapToTalk = ({
|
|
|
1133
1150
|
} else {
|
|
1134
1151
|
console.log("[TapToTalk] Starting voice... mode:", voiceConfig == null ? void 0 : voiceConfig.mode);
|
|
1135
1152
|
setErrorMsg(null);
|
|
1136
|
-
if (
|
|
1137
|
-
console.log("[TapToTalk]
|
|
1138
|
-
|
|
1153
|
+
if (isMobile()) {
|
|
1154
|
+
console.log("[TapToTalk] Mobile: Blurring active element and skipping onFocusTarget");
|
|
1155
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
1156
|
+
document.activeElement.blur();
|
|
1157
|
+
}
|
|
1139
1158
|
} else if (onFocusTarget) {
|
|
1140
|
-
console.log("[TapToTalk]
|
|
1141
|
-
|
|
1142
|
-
console.log("[TapToTalk] onFocusTarget is undefined");
|
|
1159
|
+
console.log("[TapToTalk] Desktop: calling onFocusTarget()");
|
|
1160
|
+
onFocusTarget();
|
|
1143
1161
|
}
|
|
1144
1162
|
setVoiceTrigger("click");
|
|
1145
1163
|
console.log("[TapToTalk] voiceTrigger set to click");
|