@contentgrowth/llm-service 0.9.5 → 0.9.6

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.
@@ -149,7 +149,7 @@ function ChatHeader({
149
149
 
150
150
  // src/ui/react/components/ChatInputArea.tsx
151
151
  import { useState as useState3, useRef as useRef3, useImperativeHandle, forwardRef, useEffect as useEffect3, useCallback as useCallback3, useLayoutEffect } from "react";
152
- import { MicrophoneIcon, StopIcon, PaperAirplaneIcon, XMarkIcon } from "@heroicons/react/24/outline";
152
+ import { MicrophoneIcon, StopIcon, PaperAirplaneIcon, XMarkIcon, Square2StackIcon } from "@heroicons/react/24/outline";
153
153
 
154
154
  // src/ui/react/hooks/useSpeechRecognition.ts
155
155
  import { useState, useEffect, useCallback, useRef } from "react";
@@ -431,6 +431,9 @@ var ChatInputArea = forwardRef(({
431
431
  console.error = originalError;
432
432
  };
433
433
  }, []);
434
+ const copyLogs = useCallback3(() => {
435
+ navigator.clipboard.writeText(logs.join("\n")).then(() => alert("Logs copied to clipboard")).catch((err) => console.error("Failed to copy logs", err));
436
+ }, [logs]);
434
437
  const textareaRef = useRef3(null);
435
438
  const measurementRef = useRef3(null);
436
439
  const pendingSelectionRef = useRef3(null);
@@ -623,7 +626,13 @@ var ChatInputArea = forwardRef(({
623
626
  showDebug && /* @__PURE__ */ jsxs3("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: [
624
627
  /* @__PURE__ */ jsxs3("div", { className: "flex justify-between items-center bg-gray-800 p-1 mb-1", children: [
625
628
  /* @__PURE__ */ jsx5("span", { children: "Debug Logs" }),
626
- /* @__PURE__ */ jsx5("button", { onClick: () => setShowDebug(false), className: "text-white hover:text-red-400", children: /* @__PURE__ */ jsx5(XMarkIcon, { className: "w-4 h-4" }) })
629
+ /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
630
+ /* @__PURE__ */ jsx5("button", { onClick: copyLogs, className: "text-white hover:text-blue-400", title: "Copy Logs", children: /* @__PURE__ */ jsx5(Square2StackIcon, { className: "w-4 h-4" }) }),
631
+ /* @__PURE__ */ jsx5("button", { onClick: () => {
632
+ copyLogs();
633
+ setShowDebug(false);
634
+ }, className: "text-white hover:text-red-400", title: "Copy & Close", children: /* @__PURE__ */ jsx5(XMarkIcon, { className: "w-4 h-4" }) })
635
+ ] })
627
636
  ] }),
628
637
  logs.map((log, i) => /* @__PURE__ */ jsx5("div", { className: "mb-0.5 border-b border-gray-700/50 pb-0.5 break-all", children: log }, i)),
629
638
  logs.length === 0 && /* @__PURE__ */ jsx5("div", { children: "No logs yet..." })
@@ -644,6 +653,7 @@ var ChatInputArea = forwardRef(({
644
653
  if (tapCountRef.current.count >= 5) {
645
654
  setShowDebug((prev) => !prev);
646
655
  tapCountRef.current.count = 0;
656
+ stopRecording();
647
657
  return;
648
658
  }
649
659
  if (voiceTrigger) {
@@ -765,7 +775,7 @@ ChatInputArea.displayName = "ChatInputArea";
765
775
 
766
776
  // src/ui/react/components/TapToTalk.tsx
767
777
  import React3, { useState as useState4, useCallback as useCallback4, useRef as useRef4 } from "react";
768
- import { MicrophoneIcon as MicrophoneIcon2, XMarkIcon as XMarkIcon2 } from "@heroicons/react/24/outline";
778
+ import { MicrophoneIcon as MicrophoneIcon2, XMarkIcon as XMarkIcon2, Square2StackIcon as Square2StackIcon2 } from "@heroicons/react/24/outline";
769
779
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
770
780
  var TapToTalk = ({
771
781
  onResult,
@@ -818,6 +828,9 @@ var TapToTalk = ({
818
828
  console.error = originalError;
819
829
  };
820
830
  }, []);
831
+ const copyLogs = useCallback4(() => {
832
+ navigator.clipboard.writeText(logs.join("\n")).then(() => alert("Logs copied to clipboard")).catch((err) => console.error("Failed to copy logs", err));
833
+ }, [logs]);
821
834
  const handleVoiceResult = useCallback4((text, isFinal) => {
822
835
  if (isFinal) {
823
836
  onResult(text);
@@ -873,6 +886,11 @@ var TapToTalk = ({
873
886
  if (tapCountRef.current.count >= 5) {
874
887
  setShowDebug((prev) => !prev);
875
888
  tapCountRef.current.count = 0;
889
+ if (isActive) {
890
+ if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") nativeSpeech.stop();
891
+ else customRecorder.stop();
892
+ setVoiceTrigger(null);
893
+ }
876
894
  return;
877
895
  }
878
896
  if (isActive) {
@@ -923,10 +941,17 @@ var TapToTalk = ({
923
941
  showDebug && /* @__PURE__ */ jsxs4("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: [
924
942
  /* @__PURE__ */ jsxs4("div", { className: "flex justify-between items-center bg-gray-800 p-1 mb-1", children: [
925
943
  /* @__PURE__ */ jsx6("span", { children: "Debug Logs" }),
926
- /* @__PURE__ */ jsx6("button", { onClick: (e) => {
927
- e.stopPropagation();
928
- setShowDebug(false);
929
- }, className: "text-white hover:text-red-400", children: /* @__PURE__ */ jsx6(XMarkIcon2, { className: "w-4 h-4" }) })
944
+ /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
945
+ /* @__PURE__ */ jsx6("button", { onClick: (e) => {
946
+ e.stopPropagation();
947
+ copyLogs();
948
+ }, className: "text-white hover:text-blue-400", title: "Copy Logs", children: /* @__PURE__ */ jsx6(Square2StackIcon2, { className: "w-4 h-4" }) }),
949
+ /* @__PURE__ */ jsx6("button", { onClick: (e) => {
950
+ e.stopPropagation();
951
+ copyLogs();
952
+ setShowDebug(false);
953
+ }, className: "text-white hover:text-red-400", title: "Copy & Close", children: /* @__PURE__ */ jsx6(XMarkIcon2, { className: "w-4 h-4" }) })
954
+ ] })
930
955
  ] }),
931
956
  logs.map((log, i) => /* @__PURE__ */ jsx6("div", { className: "mb-0.5 border-b border-gray-700/50 pb-0.5 break-all", children: log }, i)),
932
957
  logs.length === 0 && /* @__PURE__ */ jsx6("div", { children: "No logs yet..." })