feat: 优化 seglist 段处理,支持回复引用内容的文本合并#72
Open
minecraft1024a wants to merge 1 commit into
Open
Conversation
Contributor
Reviewer's GuideThis PR refines seglist handling to treat reply-quoted content specially by only merging text/mentions (not media), and updates the OneBot→Napcat adapter to pass a group/private context flag so reply handling can skip @-mentions in private chats while propagating it through recursive segment processing. Sequence diagram for reply handling with group/private contextsequenceDiagram
participant SendHandler
participant send_normal_message
participant handle_seg_recursive
participant process_message_by_type
participant handle_reply_message
SendHandler->>send_normal_message: send_normal_message envelope
send_normal_message->>send_normal_message: is_group = bool group_info.group_id
send_normal_message->>handle_seg_recursive: handle_seg_recursive seg_data user_info is_group
handle_seg_recursive->>process_message_by_type: process_message_by_type seg payload user_info is_group
process_message_by_type->>handle_reply_message: handle_reply_message message_id user_info is_group
alt [not is_group]
handle_reply_message-->>process_message_by_type: return reply_seg without at
else [is_group]
handle_reply_message->>handle_reply_message: check enable_reply_at
handle_reply_message-->>process_message_by_type: return reply payload with at when enabled
end
process_message_by_type-->>handle_seg_recursive: new_payload
handle_seg_recursive-->>send_normal_message: processed_message
send_normal_message-->>SendHandler: complete sending
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The detection of reply content in
_handle_seglistbased on string prefixes like"[回复<"and"「回复:"is quite brittle; consider centralizing this logic into a helper with clearer rules (e.g., configurable prefixes or a more structured flag) so it’s easier to maintain and less locale-dependent. - In
handle_reply_message, logging"私聊消息,跳过引用艾特"at info level may be noisy for normal private message traffic; consider downgrading this to debug so it doesn’t clutter logs in common paths.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The detection of reply content in `_handle_seglist` based on string prefixes like `"[回复<"` and `"「回复:"` is quite brittle; consider centralizing this logic into a helper with clearer rules (e.g., configurable prefixes or a more structured flag) so it’s easier to maintain and less locale-dependent.
- In `handle_reply_message`, logging `"私聊消息,跳过引用艾特"` at info level may be noisy for normal private message traffic; consider downgrading this to debug so it doesn’t clutter logs in common paths.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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 by Sourcery
Improve handling of segmented reply content and adjust reply mention behavior based on group vs private chats.
New Features: