voice note requires dgm

This commit is contained in:
Arjun 2026-02-09 15:29:26 +05:30
parent 2bb27e477f
commit 399bd9a6e8

View file

@ -460,12 +460,25 @@ async function transcribeWithDeepgram(audioBlob: Blob): Promise<string | null> {
// 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<MediaRecorder | null>(null)
const chunksRef = React.useRef<Blob[]>([])
const notePathRef = React.useRef<string | null>(null)
const timestampRef = React.useRef<string | null>(null)
const relativePathRef = React.useRef<string | null>(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 (
<Tooltip>
<TooltipTrigger asChild>