fix: strip segment text to remove extra blank lines in segmented reply#8304
Merged
Soulter merged 2 commits intoMay 28, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the warning message for slow text-to-image rendering to direct users to the WebUI and ensures that plain text segments are stripped before being appended to the result chain. A review comment suggests optimizing the stripping logic by assigning the stripped string to a variable to avoid redundant computations and improve code readability.
This comment was marked as outdated.
This comment was marked as outdated.
Member
这里 PR没问题。 |
72e1990 to
8cfb5de
Compare
Dt8333
approved these changes
May 27, 2026
7c5d6bd to
0bcc662
Compare
Soulter
approved these changes
May 28, 2026
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.
修复说明
修复分段回复时 Plain(seg) 未 strip 导致 QQ 消息出现多余空行的问题。
问题描述
在 stage.py 的分段回复逻辑中,分段后的文本 seg 在添加到 new_chain 前只做了非空判断(if seg.strip()),但实际添加到链中时使用的是原始的 Plain(seg) 而非 Plain(seg.strip()),这导致每段文本的收尾空格/换行被保留,在 QQ 消息中产生多余空行。
修复方案
将 new_chain.append(Plain(seg)) 改为 new_chain.append(Plain(seg.strip())),确保每段文本的首尾空白字符被去除。
关联 Issue: #8300
Summary by Sourcery
Strip whitespace in segmented replies to avoid extra blank lines and clarify guidance for disabling text-to-image mode when rendering is slow.
Bug Fixes:
Enhancements: