import { apiUpload } from "@/lib/api/client"; export type TranscriptionResult = { ok: boolean; configured: boolean; transcript: string; reason: string | null; duration_seconds: number | null; }; /** * Send a recorded audio clip to the backend for transcription. The backend is * honest: `configured` is false when the server has no Deepgram key, `ok` is * true only when real speech was transcribed. Never throws for a "no speech" * clip — that comes back as ok:false with a reason. */ export async function transcribeLecture(audio: Blob, filename = "lecture.webm"): Promise { const formData = new FormData(); formData.append("file", audio, filename); return apiUpload("/record-lecture/transcribe", formData, { timeoutMs: 90_000 }); }