Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Switch Deepgram transcription to file upload

Richie McIlroy2c49c7d3bfe4
diff --git a/apps/web/workflows/transcribe.ts b/apps/web/workflows/transcribe.ts
index 2db8abc37..deb8b0e1d 100644
--- a/apps/web/workflows/transcribe.ts
+++ b/apps/web/workflows/transcribe.ts
@@ -197,19 +197,19 @@ async function extractAudio(
async function transcribeWithDeepgram(audioUrl: string): Promise<string> {
"use step";
- const audioCheckResponse = await fetch(audioUrl, {
- method: "HEAD",
- });
- if (!audioCheckResponse.ok) {
+ const audioResponse = await fetch(audioUrl);
+ if (!audioResponse.ok) {
throw new Error(
- `Audio URL not accessible: ${audioCheckResponse.status} ${audioCheckResponse.statusText}`,
+ `Audio URL not accessible: ${audioResponse.status} ${audioResponse.statusText}`,
);
}
+ const audioBuffer = Buffer.from(await audioResponse.arrayBuffer());
+
const deepgram = createClient(serverEnv().DEEPGRAM_API_KEY as string);
- const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
- { url: audioUrl },
+ const { result, error } = await deepgram.listen.prerecorded.transcribeFile(
+ audioBuffer,
{
model: "nova-3",
smart_format: true,