Skip to content

fix(weixin): accept voice transcription text#1864

Merged
piorpua merged 2 commits intoiOfficeAI:mainfrom
JerryLiu369:fix/weixin-voice-text
Mar 29, 2026
Merged

fix(weixin): accept voice transcription text#1864
piorpua merged 2 commits intoiOfficeAI:mainfrom
JerryLiu369:fix/weixin-voice-text

Conversation

@JerryLiu369
Copy link
Copy Markdown
Member

Summary

  • treat Weixin voice items with voice_item.text as inbound text
  • merge voice transcription text into the existing text message payload
  • add monitor coverage for mixed text + voice transcription input

Testing

  • bunx vitest run tests/unit/channels/weixinMonitor.test.ts tests/unit/channels/weixinAdapter.test.ts
  • bun run build:renderer:web
  • bun run build:server

@sentry
Copy link
Copy Markdown

sentry bot commented Mar 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e9e73afc3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


const conversationId = msg.from_user_id ?? '';
const text = textItem?.text_item?.text ?? '';
const text = [textItem?.text_item?.text?.trim(), ...voiceTextItems.map((item) => item.voice_item?.text?.trim())]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not trim inbound message text before dispatch

This change now calls .trim() on the regular text_item.text before sending it to agent.chat, which is a behavior regression for all existing text messages (even when no voice item is present). Leading/trailing spaces and newlines are user input and may be meaningful (e.g., formatting, prompts, or command-like content), so stripping them can change intent compared with previous behavior where text was forwarded verbatim.

Useful? React with 👍 / 👎.

@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 29, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 29, 2026

Code Review:fix(weixin): accept voice transcription text (#1864)

变更概述

本 PR 为微信频道(WeixinMonitor.ts)增加对语音转文字消息(type=3, voice_item.text)的支持,将语音转写内容与普通文本消息合并后传给 agent。同时在 weixinMonitor.test.ts 中补充了两个覆盖新逻辑的测试用例。


方案评估

结论:✅ 方案合理

方案直接在现有消息处理管道内扩展,增加 VOICE_ITEM_TYPE 常量、类型定义和过滤逻辑,与已有的 TEXT_ITEM_TYPE / IMAGE_ITEM_TYPE 处理方式完全对称一致。文本合并逻辑通过 trim() + Boolean() 过滤,边界情况(空语音、纯语音无文本、混合模式)均得到正确处理,没有引入不必要的复杂度。


问题清单

✅ 未发现任何问题,代码质量良好。


汇总

无问题。

结论

批准合并 — 无阻塞性问题。逻辑正确,测试覆盖充分,codecov 确认所有改动行均有覆盖,方案与项目现有架构一致。

CONCLUSION: APPROVED
IS_CRITICAL_PATH: false
PR_NUMBER: 1864


本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。

@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 29, 2026

✅ 已自动 review,无阻塞性问题,正在触发自动合并。

@piorpua piorpua merged commit 5337d4b into iOfficeAI:main Mar 29, 2026
14 checks passed
@piorpua piorpua added bot:done Auto-merged by bot and removed bot:reviewing Review in progress (mutex) labels Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:done Auto-merged by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants