Skip to content

fix(weixin): send single message per response instead of splitting - #7528

Closed
Liuwei1125 wants to merge 2 commits into
NousResearch:mainfrom
Liuwei1125:fix/weixin-single-message-delivery
Closed

fix(weixin): send single message per response instead of splitting#7528
Liuwei1125 wants to merge 2 commits into
NousResearch:mainfrom
Liuwei1125:fix/weixin-single-message-delivery

Conversation

@Liuwei1125

Copy link
Copy Markdown

Summary

优化微信消息回复策略:将原来按换行/markdown 单元拆分多条消息的方式,改为"一次回复 = 一条消息"。

Problem

之前的 _split_text_for_weixin_delivery 会把一条回复按换行、markdown 单元拆成多条消息发送,导致用户体验碎片化。

Solution

  • 短内容(≤ max_length):直接发送单条消息
  • 超长内容:截断(truncate)而非拆分,保留可读性
- Prefer one message per top-level line/markdown unit when the author used
- explicit line breaks. Oversized units fall back to block-aware packing so
- long code fences still split safely.
+ A single response = a single Weixin message.  Only split when the content
+ genuinely exceeds the API limit.  Oversized content is truncated (not
+ broken into multiple messages) to preserve readability.

liuwei53 added 2 commits April 10, 2026 23:12
Fix AttributeError when self.request_overrides is None in gateway
mode, causing UnboundLocalError on api_kwargs and breaking all
messaging platform integrations (Weixin, Telegram, etc.).

Line 5522 called .get() directly on self.request_overrides without
null-checking. While __init__ initializes it as dict(), gateway mode
may create AIAgent instances without passing request_overrides.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #8665 which synthesizes the best fixes from ~25 community PRs into a single consolidated change. Your contribution (single message per response) was reviewed and informed the final implementation. Thank you @Liuwei1125 for your work on this!

@teknium1 teknium1 closed this Apr 12, 2026
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