Skip to content

fix(qq): deliver a voice message as the platform's ASR text - #1827

Merged
devin-ai-integration[bot] merged 1 commit into
Fei2411:devfrom
lhy-dcf:fix/1824-qq-voice-asr
Nov 19, 2026
Merged

devin-ai-integration[bot] merged 1 commit into
Fei2411:devfrom
lhy-dcf:fix/1824-qq-voice-asr

Conversation

@lhy-dcf

@lhy-dcf lhy-dcf commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Issue

Fixes #1824

What changed / 改了什么

ds-bot/src/host/im/platforms/qq.js: inbound normalisation now derives text from a textOf(d) helper instead of String(d.content ?? '').trim().

Root cause. A QQ voice message carries no content. The adapter took content as the only text source, so a voice event normalised to text: ''; the common IM entry then returned before rt.sendUser and the message disappeared without a log line. The transcript never had to be fetched — QQ already puts its own ASR result on the attachment as asr_refer_text.

Mechanism. textOf(d) keeps the sender's own content when it is non-empty (a caption typed alongside the voice still wins), and otherwise joins the trimmed asr_refer_text of every content_type === 'voice' attachment. A voice attachment with no ASR text still yields '', so the downstream "no text" path is unchanged rather than newly short-circuited here.

Images and incoming files are deliberately out of scope: they need an upload/download path, not a normalisation change. This PR is only the text channel of the voice event.

Changelog

Voice messages sent to a Bot over QQ now reach the Bot as the platform's own transcription instead of being dropped silently.

How I checked it / 怎么验证的

  • npm test (in ds-bot/), see the boundary note below for what I could run
  • node scripts/build-client.mjs --check — not run: qq.js is host-side, not part of the client bundle
  • npm run lint — not runnable here: it needs a checked-out deepseek-harness with its packages installed
  • Smoke test — no live QQ app credentials available here
  • Screenshot — no interface change

Three cases added to test/im-qq.test.js, driven through the existing fake gateway + fake socket harness:

  1. voice with content: '' and asr_refer_text: '明天下午三点开会' → msg.text is that text. Red before the fix ('' !== '明天下午三点开会'), green after.
  2. voice attachment without asr_refer_text → text: ''; the event still reaches onMessage (guards the "dropped before delivery" half of the report).
  3. voice with a typed caption → the caption wins.

Evidence boundary: reverse check is a real one — I reverted textOf(d) back to the old expression, kept the new tests, and exactly case 1 failed (12/13); restoring the fix gave 13/13. The wider IM group (im-qq, im-qq-markdown, im-format, im-discord) is 37/37 green; im-telegram.test.js fails to load in this checkout because the @deepseek-ai/dsh-llm package is not installed here, which is unrelated to this change (it imports nothing from qq.js).

Not verified: a real QQ voice event end to end. The field name and the content_type === 'voice' discriminator come from the official MessageAttachment table quoted in the report, and the payload shape used in the tests copies it.


Devin Review

A QQ voice event carries no `content`. The adapter normalised every inbound
event to `text: String(d.content ?? '').trim()` and hard-coded
`images: [], files: []`, so a voice message became an empty text and the
common IM entry dropped it before it reached the Bot (Fei2411#1824).

The transcript is already on the wire: each voice attachment carries the
platform's own ASR result in `asr_refer_text`. `textOf()` now falls back to
the joined transcript of every voice attachment when `content` is empty, and
keeps a typed caption ahead of it when the sender wrote one.

Refs Fei2411#1824

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

@Fei2411 Fei2411 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Approve. Fixes #1824.

With textOf(d), a caption still wins. A voice message with no content now delivers its asr_refer_text, and several voice attachments are joined with newlines. Non-voice attachments and a voice attachment without ASR text produce no text, so an empty message is still treated as before.

Local check, merged onto current dev: im-qq (13/13) and im (59/59) pass, lint and build-client --check are clean, and all CI checks are green. As you noted, it has not been checked against a live QQ account.

Overlap: #1201 also edits src/host/im/platforms/qq.js and conflicts with this PR, but it does not handle voice ASR, so this PR is not a duplicate.

Written by Devin

@devin-ai-integration
devin-ai-integration Bot merged commit 95a69d3 into Fei2411:dev Nov 19, 2026
16 checks passed
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