File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -197,19 +197,19 @@ async function extractAudio(
197197async function transcribeWithDeepgram ( audioUrl : string ) : Promise < string > {
198198 "use step" ;
199199
200- const audioCheckResponse = await fetch ( audioUrl , {
201- method : "HEAD" ,
202- } ) ;
203- if ( ! audioCheckResponse . ok ) {
200+ const audioResponse = await fetch ( audioUrl ) ;
201+ if ( ! audioResponse . ok ) {
204202 throw new Error (
205- `Audio URL not accessible: ${ audioCheckResponse . status } ${ audioCheckResponse . statusText } ` ,
203+ `Audio URL not accessible: ${ audioResponse . status } ${ audioResponse . statusText } ` ,
206204 ) ;
207205 }
208206
207+ const audioBuffer = Buffer . from ( await audioResponse . arrayBuffer ( ) ) ;
208+
209209 const deepgram = createClient ( serverEnv ( ) . DEEPGRAM_API_KEY as string ) ;
210210
211- const { result, error } = await deepgram . listen . prerecorded . transcribeUrl (
212- { url : audioUrl } ,
211+ const { result, error } = await deepgram . listen . prerecorded . transcribeFile (
212+ audioBuffer ,
213213 {
214214 model : "nova-3" ,
215215 smart_format : true ,
You can’t perform that action at this time.
0 commit comments