mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-09 15:22:39 +02:00
fix dgm api key location
This commit is contained in:
parent
158d90f415
commit
3542f10a6c
1 changed files with 5 additions and 4 deletions
|
|
@ -149,15 +149,15 @@ async function transcribeWithDeepgram(audioBlob: Blob): Promise<string | null> {
|
||||||
path: 'config/deepgram.json',
|
path: 'config/deepgram.json',
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
})
|
})
|
||||||
const { api_key } = JSON.parse(configResult.data) as { api_key: string }
|
const { apiKey } = JSON.parse(configResult.data) as { apiKey: string }
|
||||||
if (!api_key) throw new Error('No api_key in deepgram.json')
|
if (!apiKey) throw new Error('No apiKey in deepgram.json')
|
||||||
|
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
'https://api.deepgram.com/v1/listen?model=nova-2&smart_format=true',
|
'https://api.deepgram.com/v1/listen?model=nova-2&smart_format=true',
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Token ${api_key}`,
|
Authorization: `Token ${apiKey}`,
|
||||||
'Content-Type': audioBlob.type,
|
'Content-Type': audioBlob.type,
|
||||||
},
|
},
|
||||||
body: audioBlob,
|
body: audioBlob,
|
||||||
|
|
@ -167,7 +167,8 @@ async function transcribeWithDeepgram(audioBlob: Blob): Promise<string | null> {
|
||||||
if (!response.ok) throw new Error(`Deepgram API error: ${response.status}`)
|
if (!response.ok) throw new Error(`Deepgram API error: ${response.status}`)
|
||||||
const result = await response.json()
|
const result = await response.json()
|
||||||
return result.results?.channels?.[0]?.alternatives?.[0]?.transcript ?? null
|
return result.results?.channels?.[0]?.alternatives?.[0]?.transcript ?? null
|
||||||
} catch {
|
} catch (err) {
|
||||||
|
console.error('Deepgram transcription failed:', err)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue