Record review audio in the browser
The review panel can now record from the microphone as well as take a file. The take is made with MediaRecorder at 32 kbps, which is plenty for speech and puts the 25 MB limit at over an hour; it stops itself just short of that. It is named .webm (Chrome, Firefox) or .m4a (Safari) to match its container, since the server picks the format by extension, so the backend is unchanged. Whichever recording is chosen, recorded or picked, gets a player to check it before sending. Closing the panel mid-take discards it and releases the microphone. Recording needs HTTPS or localhost; elsewhere the button is disabled with a note saying why. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -157,6 +157,7 @@ The Explain panel on a problem page (admin only) asks Claude for an intuitive ex
|
||||
|
||||
The "Review my explanation" panel (admin only) takes a recording of the admin explaining a solution out loud, as to an interviewer, and commits feedback on it as `reviews/<id>.md`. The id is the UTC time it started (`2026-10-20-153000`), so each attempt is its own file and the page lists them newest first.
|
||||
|
||||
- **Recording in the browser.** Besides a file picker, the panel records from the microphone (`AudioRecorder.vue`, `MediaRecorder` at 32 kbps): webm/Opus in Chrome and Firefox, m4a in Safari, named with that extension because the server picks the format by it. A take stops itself just short of 25 MB (over an hour), and either kind of recording gets a player to check before sending. The microphone needs a secure context, so it works on the deployed HTTPS site and on `localhost`, not over plain HTTP on a LAN address.
|
||||
- **Transcription.** Claude cannot take audio, so the recording goes first to an OpenAI-compatible `/v1/audio/transcriptions` endpoint: `TRANSCRIBE_URL` (default the OpenAI API) with `TRANSCRIBE_MODEL` (default `whisper-1`, about $0.006 a minute). It asks for word and segment timestamps, and for a verbatim transcript, because Whisper otherwise drops the fillers. A self-hosted faster-whisper server works by changing the URL.
|
||||
- **Metrics.** Pace (words per minute), pauses of 2 seconds or more, filler-word counts and when complexity was first mentioned are measured from the timestamps (`transcribe.Metrics`), since Claude never hears the recording. It is told so, and judges delivery from the words and these numbers only, not tone.
|
||||
- **Review.** The statement, examples, optionally the main solution file, the admin's note, the metrics and the timestamped transcript go to Claude with a JSON schema (`internal/review` `Schema`): a verdict (correct, partly correct, incorrect, incomplete), a restatement, an assessment of the approach and complexities, missed edge cases, delivery feedback quoting `[mm:ss]`, 1 to 5 scores in five areas, strengths and things to work on. The markdown ends with the metrics and the full transcript. Its first line is a `<!-- review verdict=… audio=… -->` comment the index reads.
|
||||
|
||||
Reference in New Issue
Block a user