Refactor ASR input types and enhance CJK handling#2581
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates ASR input handling to be more flexible via configuration and improves ASR reply gating for CJK languages where whitespace tokenization is unreliable.
Changes:
- Added CJK detection in ASR reply handling to gate “final” transcripts using character length instead of word count.
- Updated
greeting_conversation.json5to make the ASR input type configurable via an environment-variable-like placeholder. - Changed ElevenLabs ASR default websocket endpoint.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
src/inputs/plugins/google_asr.py |
Adds CJK detection to decide when to enqueue ASR replies. |
src/inputs/plugins/google_asr_rtsp.py |
Mirrors the CJK gating change for the RTSP variant. |
src/inputs/plugins/elevenlabs_asr.py |
Adds CJK gating and changes the default ElevenLabs ASR websocket URL. |
src/inputs/plugins/elevenlabs_asr_rtsp.py |
Mirrors the CJK gating change for the RTSP variant. |
config/greeting_conversation.json5 |
Makes ASR input type configurable via a placeholder string. |
Rename temporary variable _has_cjk to has_cjk in elevenlabs_asr.py and elevenlabs_asr_rtsp.py and update related conditionals. Also adjust import ordering for re and logging in elevenlabs_asr_rtsp.py and google_asr_rtsp.py to satisfy style/linting. Functional behavior remains unchanged.
Replace the default ASR websocket URL from a local ws address to the secure production wss endpoint at api.openmind.com. Keeps the same path and api_key query parameter and preserves override via config.base_url; this ensures the plugin uses the secure production ASR service by default instead of a local/dev server.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Add tests for CJK acceptance/rejection logic across ElevenLabs and Google ASR input modules (including RTSP variants). The new tests validate that committed/asr_reply messages containing Chinese, Japanese (hiragana), and Korean (Hangul) are accepted when longer than two characters, while messages of two or fewer CJK characters (and single-character CJK) are rejected. Mixed Latin+CJK messages are also verified to be accepted via the CJK path. Tests use existing provider mocks/patches and assert expected message_buffer behavior to prevent regressions in multilingual ASR handling.
Replace occurrences of "{ASR_INPUT_PLUGIN:-GoogleASRInput}" with "${ASR_INPUT_PLUGIN:-GoogleASRInput}" in config/greeting_conversation.json5 (three locations). This enables shell-style environment variable expansion with a default of GoogleASRInput instead of keeping the literal brace form.
Clean up test files by removing redundant inline comments in ASR tests. Deleted explanatory comment lines that described character counts/acceptance for CJK examples in tests/tests/inputs/plugins/test_google_asr.py and tests/inputs/plugins/test_elevenlabs_asr_rtsp.py. No test logic was changed—this is a cosmetic cleanup to reduce noise in the test code.
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.
Overview
Refactor ASR input types to utilize a plugin format and improve handling of CJK characters in ASR responses.
Type of change
Changes
Updated ASR input types to a plugin format and enhanced the logic for processing CJK characters in ASR replies.
Checklist
Impact
Changes improve the flexibility of ASR input handling and ensure better performance with CJK character sets. Reviewers should be aware of potential impacts on existing ASR configurations.
Additional Information
No additional information at this time.