diff --git a/apps/x/apps/renderer/src/components/sidebar-content.tsx b/apps/x/apps/renderer/src/components/sidebar-content.tsx index edf370ad..0d8d9aea 100644 --- a/apps/x/apps/renderer/src/components/sidebar-content.tsx +++ b/apps/x/apps/renderer/src/components/sidebar-content.tsx @@ -460,12 +460,25 @@ async function transcribeWithDeepgram(audioBlob: Blob): Promise { // Voice Note Recording Button function VoiceNoteButton({ onNoteCreated }: { onNoteCreated?: (path: string) => void }) { const [isRecording, setIsRecording] = React.useState(false) + const [hasDeepgramKey, setHasDeepgramKey] = React.useState(false) const mediaRecorderRef = React.useRef(null) const chunksRef = React.useRef([]) const notePathRef = React.useRef(null) const timestampRef = React.useRef(null) const relativePathRef = React.useRef(null) + React.useEffect(() => { + window.ipc.invoke('workspace:readFile', { + path: 'config/deepgram.json', + encoding: 'utf8', + }).then((result: { data: string }) => { + const { apiKey } = JSON.parse(result.data) as { apiKey: string } + setHasDeepgramKey(!!apiKey) + }).catch(() => { + setHasDeepgramKey(false) + }) + }, []) + const startRecording = async () => { try { // Generate timestamp and paths immediately @@ -627,6 +640,8 @@ ${transcript} setIsRecording(false) } + if (!hasDeepgramKey) return null + return (