feat(messaging): support chunkMode for outbound text messages#58
Open
zhonghe0615 wants to merge 1 commit intoTencent:mainfrom
Open
feat(messaging): support chunkMode for outbound text messages#58zhonghe0615 wants to merge 1 commit intoTencent:mainfrom
zhonghe0615 wants to merge 1 commit intoTencent:mainfrom
Conversation
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
This change adds
chunkModesupport to outbound text messages in thedelivercallback, so long AI replies can be split into multiple WeChatmessages instead of always arriving as one.
Changes
chunkMarkdownTextWithModeandChunkModefromopenclaw/plugin-sdk/reply-runtimeDEFAULT_TEXT_CHUNK_LIMIT = 4000constant (mirrors core default)sendMessageWeixincall in thedelivercallback witha chunking loop driven by
chunkModeandtextChunkLimitfrom channel configWhy
The existing chunking logic lived in
channel.ts→sendText, butsendTextis never called on the normal message path. The
delivercallback inprocessOneMessagecalledsendMessageWeixindirectly, sochunkModeconfighad no effect at runtime.
With this change, chunking is applied where messages are actually sent:
"length"(default): sends as one message unless the reply exceedstextChunkLimit(4000 chars), preserving existing behavior"newline": splits at paragraph boundaries (\n\n), delivering eachparagraph as a separate WeChat message
Config keys:
channels.openclaw-weixin.chunkMode: "length" | "newline"
channels.openclaw-weixin.textChunkLimit:
Validation
channels.openclaw-weixin.chunkMode = "newline"in configchunkModefrom config and confirmed single-message behavior(default
"length"mode) still works correctly