@contentgrowth/llm-service 0.9.5 → 0.9.7

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.
@@ -217,7 +217,6 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
217
217
  const recognition = new SpeechRecognition();
218
218
  recognition.continuous = true;
219
219
  recognition.interimResults = true;
220
- recognition.lang = language;
221
220
  recognition.onstart = () => {
222
221
  setIsListening(true);
223
222
  setError(null);
@@ -278,6 +277,11 @@ var useSpeechRecognition = (onResult, onEnd, language = "en-US") => {
278
277
  recognitionRef.current.stop();
279
278
  }
280
279
  };
280
+ }, []);
281
+ (0, import_react2.useEffect)(() => {
282
+ if (recognitionRef.current) {
283
+ recognitionRef.current.lang = language;
284
+ }
281
285
  }, [language]);
282
286
  const start = (0, import_react2.useCallback)(() => {
283
287
  if (recognitionRef.current && !isListening) {
@@ -473,6 +477,9 @@ var ChatInputArea = (0, import_react5.forwardRef)(({
473
477
  console.error = originalError;
474
478
  };
475
479
  }, []);
480
+ const copyLogs = (0, import_react5.useCallback)(() => {
481
+ navigator.clipboard.writeText(logs.join("\n")).then(() => alert("Logs copied to clipboard")).catch((err) => console.error("Failed to copy logs", err));
482
+ }, [logs]);
476
483
  const textareaRef = (0, import_react5.useRef)(null);
477
484
  const measurementRef = (0, import_react5.useRef)(null);
478
485
  const pendingSelectionRef = (0, import_react5.useRef)(null);
@@ -665,7 +672,13 @@ var ChatInputArea = (0, import_react5.forwardRef)(({
665
672
  showDebug && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "absolute bottom-full left-0 right-0 mb-2 p-2 bg-black/80 text-green-400 text-xs font-mono h-48 overflow-y-auto rounded z-50 pointer-events-auto", children: [
666
673
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex justify-between items-center bg-gray-800 p-1 mb-1", children: [
667
674
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Debug Logs" }),
668
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => setShowDebug(false), className: "text-white hover:text-red-400", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_outline.XMarkIcon, { className: "w-4 h-4" }) })
675
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex gap-2", children: [
676
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: copyLogs, className: "text-white hover:text-blue-400", title: "Copy Logs", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_outline.Square2StackIcon, { className: "w-4 h-4" }) }),
677
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => {
678
+ copyLogs();
679
+ setShowDebug(false);
680
+ }, className: "text-white hover:text-red-400", title: "Copy & Close", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_outline.XMarkIcon, { className: "w-4 h-4" }) })
681
+ ] })
669
682
  ] }),
670
683
  logs.map((log, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mb-0.5 border-b border-gray-700/50 pb-0.5 break-all", children: log }, i)),
671
684
  logs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No logs yet..." })
@@ -686,6 +699,7 @@ var ChatInputArea = (0, import_react5.forwardRef)(({
686
699
  if (tapCountRef.current.count >= 5) {
687
700
  setShowDebug((prev) => !prev);
688
701
  tapCountRef.current.count = 0;
702
+ stopRecording();
689
703
  return;
690
704
  }
691
705
  if (voiceTrigger) {
@@ -860,6 +874,9 @@ var TapToTalk = ({
860
874
  console.error = originalError;
861
875
  };
862
876
  }, []);
877
+ const copyLogs = (0, import_react6.useCallback)(() => {
878
+ navigator.clipboard.writeText(logs.join("\n")).then(() => alert("Logs copied to clipboard")).catch((err) => console.error("Failed to copy logs", err));
879
+ }, [logs]);
863
880
  const handleVoiceResult = (0, import_react6.useCallback)((text, isFinal) => {
864
881
  if (isFinal) {
865
882
  onResult(text);
@@ -915,6 +932,11 @@ var TapToTalk = ({
915
932
  if (tapCountRef.current.count >= 5) {
916
933
  setShowDebug((prev) => !prev);
917
934
  tapCountRef.current.count = 0;
935
+ if (isActive) {
936
+ if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") nativeSpeech.stop();
937
+ else customRecorder.stop();
938
+ setVoiceTrigger(null);
939
+ }
918
940
  return;
919
941
  }
920
942
  if (isActive) {
@@ -965,10 +987,17 @@ var TapToTalk = ({
965
987
  showDebug && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "absolute bottom-full left-0 right-0 mb-2 p-2 bg-black/80 text-green-400 text-xs font-mono h-48 overflow-y-auto rounded z-50 pointer-events-auto", children: [
966
988
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex justify-between items-center bg-gray-800 p-1 mb-1", children: [
967
989
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Debug Logs" }),
968
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { onClick: (e) => {
969
- e.stopPropagation();
970
- setShowDebug(false);
971
- }, className: "text-white hover:text-red-400", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_outline2.XMarkIcon, { className: "w-4 h-4" }) })
990
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex gap-2", children: [
991
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { onClick: (e) => {
992
+ e.stopPropagation();
993
+ copyLogs();
994
+ }, className: "text-white hover:text-blue-400", title: "Copy Logs", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_outline2.Square2StackIcon, { className: "w-4 h-4" }) }),
995
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { onClick: (e) => {
996
+ e.stopPropagation();
997
+ copyLogs();
998
+ setShowDebug(false);
999
+ }, className: "text-white hover:text-red-400", title: "Copy & Close", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_outline2.XMarkIcon, { className: "w-4 h-4" }) })
1000
+ ] })
972
1001
  ] }),
973
1002
  logs.map((log, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mb-0.5 border-b border-gray-700/50 pb-0.5 break-all", children: log }, i)),
974
1003
  logs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: "No logs yet..." })