mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-25 18:55:19 +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
|
// Voice Note Recording Button
|
||||||
function VoiceNoteButton({ onNoteCreated }: { onNoteCreated?: (path: string) => void }) {
|
function VoiceNoteButton({ onNoteCreated }: { onNoteCreated?: (path: string) => void }) {
|
||||||
const [isRecording, setIsRecording] = React.useState(false)
|
const [isRecording, setIsRecording] = React.useState(false)
|
||||||
|
const [hasDeepgramKey, setHasDeepgramKey] = React.useState(false)
|
||||||
const mediaRecorderRef = React.useRef<MediaRecorder | null>(null)
|
const mediaRecorderRef = React.useRef<MediaRecorder | null>(null)
|
||||||
const chunksRef = React.useRef<Blob[]>([])
|
const chunksRef = React.useRef<Blob[]>([])
|
||||||
const notePathRef = React.useRef<string | null>(null)
|
const notePathRef = React.useRef<string | null>(null)
|
||||||
const timestampRef = React.useRef<string | null>(null)
|
const timestampRef = React.useRef<string | null>(null)
|
||||||
const relativePathRef = 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 () => {
|
const startRecording = async () => {
|
||||||
try {
|
try {
|
||||||
// Generate timestamp and paths immediately
|
// Generate timestamp and paths immediately
|
||||||
|
|
@ -627,6 +640,8 @@ ${transcript}
|
||||||
setIsRecording(false)
|
setIsRecording(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasDeepgramKey) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue