Skip to content

fix(asr): skip spurious empty Interim events in qwen and doubao providers#55

Merged
missuo merged 1 commit into
missuo:mainfrom
erning:fix/asr-spurious-interim
Apr 6, 2026
Merged

fix(asr): skip spurious empty Interim events in qwen and doubao providers#55
missuo merged 1 commit into
missuo:mainfrom
erning:fix/asr-spurious-interim

Conversation

@erning

@erning erning commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 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

Problem

Both QwenProvider::next_event() and DoubaoProvider::next_event() return a fabricated empty Interim("") event when they encounter non-data frames (binary, ping/pong) or when parse_server_event produces 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 loop so meaningless frames are skipped via continue instead 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.rsnext_event()
  • koe-asr/src/doubao.rsnext_event()

Test Plan

  • cargo check -p koe-asr passes
  • cargo test -p koe-asr — all 10 tests pass
  • Verify hold-to-talk and tap-to-toggle both work with Qwen provider
  • Verify hold-to-talk and tap-to-toggle both work with Doubao provider

…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.
@missuo missuo merged commit 10fee75 into missuo:main Apr 6, 2026
@erning erning deleted the fix/asr-spurious-interim branch April 7, 2026 02:01
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.

2 participants