mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-25 00:16:29 +02:00
voice note requires dgm
This commit is contained in:
parent
2bb27e477f
commit
399bd9a6e8
1 changed files with 15 additions and 0 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue