fix: decode SSE audio stream for music and speech#130
Merged
Conversation
Music streaming was writing raw SSE text instead of decoded audio bytes. Two root causes: - extra_info filter skipped all music events (null !== undefined is true) - AbortSignal.timeout aborted long-running streaming responses Extracted pipeAudioStream() to shared util; uses status===2 to skip the terminal summary event. Disabled fetch timeout for streaming.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
extra_infofilter (!== undefined) skipped all events because music API sendsextra_info: nullon every chunk. Changed tostatus === 2to correctly skip only the terminal summary event.AbortSignal.timeoutkilled long-running streaming responses (music generation takes 90+ seconds). Disabled timeout for streaming requests.pipeAudioStream()util, replacing duplicated raw-reader code in music/cover, music/generate, and speech/synthesize.Closes #55
Test plan
speech synthesize --stream→ valid MP3 (49KB,ID3header)music generate --stream→ valid MP3 (4.8MB,ID3header)bun test— 196 passbun run lint— clean