You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0e0cdb9
Browse filesBrowse the repository at this point in the historyBrowse files
fix(tts): add streamFlush() API and drain Kokoro buffer on streamStop
The streaming loop used a timer-based force-flush after
`kStreamMaxSkippedIterations` idle iterations. It tried to extract zero
characters whenever the buffer held content without an end-of-sentence
character — the counter reset on every iteration and `streamStop(false)`
hung forever (#1153). The same threshold also fired mid-token for
LLM-style streaming, partitioning sentences before they finished.
Replace the threshold with caller-driven flushing:
- New `streamFlush()` API. Caller signals "drain what's currently
buffered, EOS or not" — typically right before `streamStop(false)` for
normal apps that ended on un-terminated content.
- `streamStop(false)` now drains automatically (equivalent to
`streamFlush()` plus auto-stop on empty buffer), so it's guaranteed to
return even if the trailing tail has no EOS.
- LLM-style callers feeding partial tokens never call `streamFlush()` —
model punctuation drives natural EOS partitioning, and the residual
tail is drained by `streamStop(false)` when generation completes.
The skipped-iteration force-flush and its tuning constant
`kStreamMaxSkippedIterations` are removed.
Fixes#1153.
0 commit comments