feat: transcribe QQ voice messages to text via GLM-ASR#57
Merged
Conversation
Add voice-to-text for QQ channel audio attachments. When GLM_API_KEY is configured, audio attachments are transcribed with GLM-ASR-2512 before being forwarded to the router/agent, so the agent receives the spoken content instead of just a file path. Unconfigured, behavior is unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
quick-sort
approved these changes
Jun 17, 2026
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
GLM_API_KEYis configured, audio attachments are transcribed in the channel layer before being forwarded to the router/agent, so the agent receives the spoken content ("用户发送了一段语音,内容: {text}") instead of just a file path.GLM_API_KEYis empty, behavior is unchanged — voice attachments fall back to the file-path-only description.src/agent_box/asr/glm.pyclient (reuses existinghttpx, no new deps). Transcription failures degrade gracefully toNone(rendered as the file path), never blocking the message flow.Test Plan
tests/test_asr.py— 6 tests: success (request shape verified), HTTP error, empty text, network error, missing file, empty filetests/test_channels.py— 8 tests:_atts_textwith/without transcription, mixed attachments,_download_attstranscribes audio / skips when ASR disabled / falls back on failure / ignores non-audio,_asrenable/disable based on keyuv run pytest tests/test_asr.py tests/test_channels.py— 42 passeduv run ruff checkon changed files — cleanCloses #56