fix(asr): skip spurious empty Interim events in qwen and doubao providers#55
Merged
Merged
Conversation
…ders Replace AsrEvent::Interim(String::new()) fallbacks with a loop that skips meaningless WS frames (binary, ping/pong, empty parse results) and waits for the next real event. Each skipped frame logs at debug level for protocol debugging. Close, error, and stream-end branches remain unchanged.
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
AsrEvent::Interim(String::new())fallbacks with aloopthat skips meaningless WS frames (binary, ping/pong, empty parse results) and waits for the next real eventdebuglevel for protocol debuggingProblem
Both
QwenProvider::next_event()andDoubaoProvider::next_event()return a fabricated emptyInterim("")event when they encounter non-data frames (binary, ping/pong) or whenparse_server_eventproduces no events. Providers should not synthesize transcript events for frames that carry no speech data. While the core layer already guards against empty text (!text.is_empty()), the spurious events still cause unnecessary polling and pollute debug logs.Fix
Wrap the WS read in a
loopso meaningless frames are skipped viacontinueinstead of producing fake events. This cleanly separates "ignore this frame" from "emit a real ASR event" without touching the terminal branches (Close / Err / None).Files Changed
koe-asr/src/qwen.rs—next_event()koe-asr/src/doubao.rs—next_event()Test Plan
cargo check -p koe-asrpassescargo test -p koe-asr— all 10 tests pass