fix(weixin): Stop auto-splitting messages by newlines; match Telegram behavior - #8329
Closed
AaronWong1999 wants to merge 1 commit into
Closed
fix(weixin): Stop auto-splitting messages by newlines; match Telegram behavior#8329AaronWong1999 wants to merge 1 commit into
AaronWong1999 wants to merge 1 commit into
Conversation
… behavior The WeChat adapter was splitting every paragraph/line-break into a separate message, flooding users' chat interfaces. This behavior was unique to WeChat — the Telegram adapter keeps messages intact and only splits when exceeding the max length limit. Changes: - Simplify _split_delivery_units_for_weixin to return content as a single unit; splitting is now handled by length only (4000 chars). - Make _should_split_short_chat_block_for_weixin return False so that even short 2-6 line messages stay together by default. - Users who prefer per-line splitting can still enable it via WEIXIN_SPLIT_MULTILINE_MESSAGES=true. Discovered while building HermesClaw (a dual-proxy router for Hermes Agent + OpenClaw on the same WeChat account). Users consistently reported the newline-splitting behavior as a major UX pain point. Credit: Aaron Wong (@AaronWong1999, X: @AaronYonW) Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Contributor
|
Merged via PR #8665 which synthesizes the best fixes from ~25 community PRs into a single consolidated change. Your contribution (stop auto-splitting by newlines) was reviewed and informed the final implementation. Thank you @AaronWong1999 for your work on this! |
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.
Problem
The WeChat adapter splits every paragraph/line-break into a separate message, flooding users' chat interfaces. This behavior is unique to WeChat — the Telegram adapter keeps messages intact and only splits when exceeding the max length limit.
Users consistently reported this as a major UX pain point, especially for longer AI replies that get broken into 5-10 separate WeChat messages.
Solution
Two targeted changes to
gateway/platforms/weixin.py:_split_delivery_units_for_weixin— Simplified to return content as a single unit. Splitting is now handled by_split_text_for_weixin_deliverybased onmax_length(4000 chars) only._should_split_short_chat_block_for_weixin— Changed to returnFalse. Previously, even withsplit_multiline_messages=false(the default), short 2-6 line messages would still be split into separate bubbles. This made the chat feel fragmented.Impact
Users who prefer the old per-line splitting behavior can still enable it via
WEIXIN_SPLIT_MULTILINE_MESSAGES=truein their config.Discovered by
This issue was discovered while building HermesClaw, a dual-proxy router that runs Hermes Agent and OpenClaw on the same WeChat account. The newline-splitting behavior was the #1 reported UX complaint from HermesClaw users.
Credit
Feel free to credit this contribution in the release notes or changelog. Happy to help the Hermes community! 🦞