@contentgrowth/llm-service 0.9.96 → 0.9.97
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.
|
@@ -557,7 +557,7 @@ var ChatInputArea = forwardRef(({
|
|
|
557
557
|
if (typeof arg === "object") return JSON.stringify(arg);
|
|
558
558
|
return String(arg);
|
|
559
559
|
}).join(" ");
|
|
560
|
-
setLogs((prev) => [`[${formatTime()}] [${type}] ${msg}
|
|
560
|
+
setLogs((prev) => [...prev, `[${formatTime()}] [${type}] ${msg}`].slice(-50));
|
|
561
561
|
} catch (e) {
|
|
562
562
|
}
|
|
563
563
|
};
|
|
@@ -721,63 +721,50 @@ var ChatInputArea = forwardRef(({
|
|
|
721
721
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
722
722
|
}, []);
|
|
723
723
|
const startRecording = async (trigger) => {
|
|
724
|
+
var _a2, _b2;
|
|
724
725
|
console.log("[ChatInputArea] startRecording called. trigger:", trigger, "isMobile:", isMobile());
|
|
725
726
|
console.log("[ChatInputArea] Current state - voiceTrigger:", voiceTrigger, "isTranscribing:", isTranscribing);
|
|
726
727
|
if (voiceTrigger || isTranscribing) {
|
|
727
728
|
console.log("[ChatInputArea] startRecording ignored - already active");
|
|
728
729
|
return;
|
|
729
730
|
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
if (
|
|
735
|
-
console.
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
setVoiceTrigger(null);
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
console.log("[ChatInputArea] Calling nativeSpeech.start()...");
|
|
743
|
-
nativeSpeech.start();
|
|
744
|
-
console.log("[ChatInputArea] nativeSpeech.start() called");
|
|
745
|
-
console.log("[ChatInputArea] Calling voiceConfig.onVoiceStart if exists (after nativeSpeech.start)...");
|
|
746
|
-
try {
|
|
747
|
-
(_a2 = voiceConfig == null ? void 0 : voiceConfig.onVoiceStart) == null ? void 0 : _a2.call(voiceConfig);
|
|
748
|
-
console.log("[ChatInputArea] voiceConfig.onVoiceStart completed");
|
|
749
|
-
} catch (e) {
|
|
750
|
-
console.error("[ChatInputArea] voiceConfig.onVoiceStart threw error", e);
|
|
751
|
-
}
|
|
752
|
-
} else {
|
|
753
|
-
console.log("[ChatInputArea] Using custom recorder");
|
|
754
|
-
console.log("[ChatInputArea] Calling voiceConfig.onVoiceStart if exists (custom mode)...");
|
|
755
|
-
try {
|
|
756
|
-
(_b2 = voiceConfig == null ? void 0 : voiceConfig.onVoiceStart) == null ? void 0 : _b2.call(voiceConfig);
|
|
757
|
-
console.log("[ChatInputArea] voiceConfig.onVoiceStart completed");
|
|
758
|
-
} catch (e) {
|
|
759
|
-
console.error("[ChatInputArea] voiceConfig.onVoiceStart threw error", e);
|
|
760
|
-
}
|
|
761
|
-
await customRecorder.start();
|
|
762
|
-
console.log("[ChatInputArea] Custom recorder started");
|
|
731
|
+
setVoiceTrigger(trigger);
|
|
732
|
+
setVoiceError(null);
|
|
733
|
+
if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") {
|
|
734
|
+
console.log("[ChatInputArea] Using native speech recognition");
|
|
735
|
+
if (!nativeSpeech.isSupported) {
|
|
736
|
+
console.error("[ChatInputArea] Native speech not supported");
|
|
737
|
+
alert("Speech recognition is not supported in this browser.");
|
|
738
|
+
setVoiceTrigger(null);
|
|
739
|
+
return;
|
|
763
740
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
console.log("[ChatInputArea]
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
741
|
+
console.log("[ChatInputArea] Calling nativeSpeech.start()...");
|
|
742
|
+
nativeSpeech.start();
|
|
743
|
+
console.log("[ChatInputArea] nativeSpeech.start() called");
|
|
744
|
+
console.log("[ChatInputArea] Calling voiceConfig.onVoiceStart if exists...");
|
|
745
|
+
try {
|
|
746
|
+
(_a2 = voiceConfig == null ? void 0 : voiceConfig.onVoiceStart) == null ? void 0 : _a2.call(voiceConfig);
|
|
747
|
+
console.log("[ChatInputArea] voiceConfig.onVoiceStart completed");
|
|
748
|
+
} catch (e) {
|
|
749
|
+
console.error("[ChatInputArea] voiceConfig.onVoiceStart threw error", e);
|
|
770
750
|
}
|
|
771
|
-
console.log("[ChatInputArea] Mobile: Waiting 300ms before starting recognition...");
|
|
772
|
-
setTimeout(() => {
|
|
773
|
-
performStart();
|
|
774
|
-
}, 300);
|
|
775
751
|
} else {
|
|
776
|
-
|
|
752
|
+
console.log("[ChatInputArea] Using custom recorder");
|
|
753
|
+
console.log("[ChatInputArea] Calling voiceConfig.onVoiceStart if exists (custom mode)...");
|
|
754
|
+
try {
|
|
755
|
+
(_b2 = voiceConfig == null ? void 0 : voiceConfig.onVoiceStart) == null ? void 0 : _b2.call(voiceConfig);
|
|
756
|
+
console.log("[ChatInputArea] voiceConfig.onVoiceStart completed");
|
|
757
|
+
} catch (e) {
|
|
758
|
+
console.error("[ChatInputArea] voiceConfig.onVoiceStart threw error", e);
|
|
759
|
+
}
|
|
760
|
+
await customRecorder.start();
|
|
761
|
+
console.log("[ChatInputArea] Custom recorder started");
|
|
762
|
+
}
|
|
763
|
+
if (!isMobile()) {
|
|
777
764
|
console.log("[ChatInputArea] Re-focusing textarea (desktop only)");
|
|
778
765
|
setTimeout(() => {
|
|
779
|
-
var
|
|
780
|
-
return (
|
|
766
|
+
var _a3;
|
|
767
|
+
return (_a3 = textareaRef.current) == null ? void 0 : _a3.focus();
|
|
781
768
|
}, 0);
|
|
782
769
|
}
|
|
783
770
|
};
|
|
@@ -1002,7 +989,7 @@ var TapToTalk = ({
|
|
|
1002
989
|
if (typeof arg === "object") return JSON.stringify(arg);
|
|
1003
990
|
return String(arg);
|
|
1004
991
|
}).join(" ");
|
|
1005
|
-
setLogs((prev) => [`[${formatTime()}] [${type}] ${msg}
|
|
992
|
+
setLogs((prev) => [...prev, `[${formatTime()}] [${type}] ${msg}`].slice(-50));
|
|
1006
993
|
} catch (e) {
|
|
1007
994
|
}
|
|
1008
995
|
};
|
|
@@ -1122,47 +1109,33 @@ var TapToTalk = ({
|
|
|
1122
1109
|
} else {
|
|
1123
1110
|
console.log("[TapToTalk] Starting voice... mode:", voiceConfig == null ? void 0 : voiceConfig.mode);
|
|
1124
1111
|
setErrorMsg(null);
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
if (!nativeSpeech.isSupported) {
|
|
1141
|
-
console.error("[TapToTalk] Native speech not supported");
|
|
1142
|
-
setErrorMsg("Speech not supported");
|
|
1143
|
-
setVoiceTrigger(null);
|
|
1144
|
-
return;
|
|
1145
|
-
}
|
|
1146
|
-
console.log("[TapToTalk] Calling nativeSpeech.start()...");
|
|
1147
|
-
nativeSpeech.start();
|
|
1148
|
-
console.log("[TapToTalk] nativeSpeech.start() called");
|
|
1149
|
-
}
|
|
1150
|
-
};
|
|
1151
|
-
if (isMobile()) {
|
|
1152
|
-
console.log("[TapToTalk] Mobile: Blurring active element and skipping onFocusTarget");
|
|
1153
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
1154
|
-
document.activeElement.blur();
|
|
1112
|
+
setVoiceTrigger("click");
|
|
1113
|
+
console.log("[TapToTalk] voiceTrigger set to click");
|
|
1114
|
+
if (!isMobile() && onFocusTarget) {
|
|
1115
|
+
console.log("[TapToTalk] Desktop: calling onFocusTarget()");
|
|
1116
|
+
onFocusTarget();
|
|
1117
|
+
}
|
|
1118
|
+
if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "custom") {
|
|
1119
|
+
console.log("[TapToTalk] Starting custom recorder...");
|
|
1120
|
+
try {
|
|
1121
|
+
await customRecorder.start();
|
|
1122
|
+
console.log("[TapToTalk] Custom recorder started successfully");
|
|
1123
|
+
} catch (e2) {
|
|
1124
|
+
console.error("[TapToTalk] Custom recorder failed:", e2);
|
|
1125
|
+
setErrorMsg("Mic access denied");
|
|
1126
|
+
setVoiceTrigger(null);
|
|
1155
1127
|
}
|
|
1156
|
-
console.log("[TapToTalk] Mobile: Waiting 300ms before starting recognition...");
|
|
1157
|
-
setTimeout(() => {
|
|
1158
|
-
performStart();
|
|
1159
|
-
}, 300);
|
|
1160
1128
|
} else {
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1129
|
+
console.log("[TapToTalk] Starting native speech recognition...");
|
|
1130
|
+
if (!nativeSpeech.isSupported) {
|
|
1131
|
+
console.error("[TapToTalk] Native speech not supported");
|
|
1132
|
+
setErrorMsg("Speech not supported");
|
|
1133
|
+
setVoiceTrigger(null);
|
|
1134
|
+
return;
|
|
1164
1135
|
}
|
|
1165
|
-
|
|
1136
|
+
console.log("[TapToTalk] Calling nativeSpeech.start()...");
|
|
1137
|
+
nativeSpeech.start();
|
|
1138
|
+
console.log("[TapToTalk] nativeSpeech.start() called");
|
|
1166
1139
|
}
|
|
1167
1140
|
}
|
|
1168
1141
|
} finally {
|