Skip to content

Write transcript to file every 20 s and refresh note summary after each write - #6

Closed
deanhume with Copilot wants to merge 2 commits into
mainfrom
copilot/update-transcription-timing
Closed

Write transcript to file every 20 s and refresh note summary after each write#6
deanhume with Copilot wants to merge 2 commits into
mainfrom
copilot/update-transcription-timing

Conversation

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Without periodic saves, a crash or unexpected close during a long recording would lose all transcribed content — the summary was only written to the note on Stop.

Changes

  • LIVE_CHUNK_MS 5 000 → 20 000 ms — transcription chunks are now processed and written to the transcript file every 20 seconds.
  • Periodic summary refresh — after each successful transcriptAppend, refreshSummaryFromFile() is called immediately (live chunks only), so the note's summary block stays current throughout the recording. A crash or unexpected close now loses at most ~20 s of content.
  • Stop path unchanged — the forced final flush (force=true) skips the in-chunk refresh; handleRecordingStop calls refreshSummaryFromFile() explicitly once the complete transcript is on disk.
// transcribeLiveChunk — inner try/catch after Whisper returns text
try {
  await window.electronAPI.transcriptAppend(text);
  if (!force) await refreshSummaryFromFile(); // read-back summarise after confirmed write
} catch (e) {
  console.error('Appending to transcript file failed:', e);
}

The ordering guarantees the file is fully written before it is read back for summarisation, matching the intended contract.

Copilot AI linked an issue Jul 2, 2026 that may be closed by this pull request
…each write

- LIVE_CHUNK_MS changed from 5000 → 20000 ms so transcription chunks are
  written to the transcript file every 20 seconds (data-loss prevention:
  the note is kept current throughout the recording; a crash or unexpected
  close loses at most ~20 s of content)
- After each successful transcriptAppend during a live chunk, call
  refreshSummaryFromFile() so the note's summary block is updated from the
  freshly-written file.  Both operations share a try/catch so errors are
  caught and logged cleanly.
- The forced final flush at Stop (force=true) skips the in-chunk summary
  refresh because handleRecordingStop already calls refreshSummaryFromFile()
  explicitly after the tail is appended.
- Updated comments throughout to accurately describe the new behaviour.
- All 105 existing tests continue to pass.
Copilot AI changed the title [WIP] Update transcription to write every 20 seconds Write transcript to file every 20 s and refresh note summary after each write Jul 2, 2026
Copilot AI requested a review from deanhume July 2, 2026 08:47
Copilot stopped work on behalf of deanhume due to an error July 2, 2026 08:49
@deanhume deanhume closed this Jul 2, 2026
@deanhume

deanhume commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Not merging this change

@deanhume
deanhume deleted the copilot/update-transcription-timing branch July 2, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update the transcription to write every 20 secs

2 participants