[feat] Add reply_with_quote_scope to support per-context quote Control#5245
Open
Luna-channel wants to merge 7 commits intoAstrBotDevs:masterfrom
Open
[feat] Add reply_with_quote_scope to support per-context quote Control#5245Luna-channel wants to merge 7 commits intoAstrBotDevs:masterfrom
reply_with_quote_scope to support per-context quote Control#5245Luna-channel wants to merge 7 commits intoAstrBotDevs:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Hey - 我给出了一些整体性的反馈:
reply_with_quote_scope的取值("all"、"group_only"、"private_only")在多处以原始字符串形式重复出现;建议将它们集中定义成常量或枚举风格的定义,以避免拼写错误,并让未来的修改更加安全。is_private的判断逻辑是明确依赖MessageType.FRIEND_MESSAGE的;如果之后新增了消息类型(例如临时会话、频道等),建议要么显式处理这些类型,要么在文档中说明这些类型在引用范围(quote scope)方面应该如何对待。- 在流水线阶段中,
reply_with_quote_scope的兜底默认值被硬编码为"all";相较于重复使用字面量,复用已配置的默认值(来自DEFAULT_CONFIG)可能会更安全。
给 AI Agent 的提示词
Please address the comments from this code review:
## Overall Comments
- The `reply_with_quote_scope` values (`"all"`, `"group_only"`, `"private_only"`) are duplicated as raw strings in multiple places; consider centralizing them as constants/enum-like definitions to avoid typos and make future changes safer.
- The `is_private` check relies specifically on `MessageType.FRIEND_MESSAGE`; if new message types (e.g., temporary sessions, channels) are added later, consider handling them explicitly or documenting how they should be treated with respect to quote scope.
- The fallback default for `reply_with_quote_scope` is hardcoded as `"all"` in the pipeline stages; it might be safer to reuse the configured default (from `DEFAULT_CONFIG`) instead of repeating the literal.帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的 Review。
Original comment in English
Hey - I've left some high level feedback:
- The
reply_with_quote_scopevalues ("all","group_only","private_only") are duplicated as raw strings in multiple places; consider centralizing them as constants/enum-like definitions to avoid typos and make future changes safer. - The
is_privatecheck relies specifically onMessageType.FRIEND_MESSAGE; if new message types (e.g., temporary sessions, channels) are added later, consider handling them explicitly or documenting how they should be treated with respect to quote scope. - The fallback default for
reply_with_quote_scopeis hardcoded as"all"in the pipeline stages; it might be safer to reuse the configured default (fromDEFAULT_CONFIG) instead of repeating the literal.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `reply_with_quote_scope` values (`"all"`, `"group_only"`, `"private_only"`) are duplicated as raw strings in multiple places; consider centralizing them as constants/enum-like definitions to avoid typos and make future changes safer.
- The `is_private` check relies specifically on `MessageType.FRIEND_MESSAGE`; if new message types (e.g., temporary sessions, channels) are added later, consider handling them explicitly or documenting how they should be treated with respect to quote scope.
- The fallback default for `reply_with_quote_scope` is hardcoded as `"all"` in the pipeline stages; it might be safer to reuse the configured default (from `DEFAULT_CONFIG`) instead of repeating the literal.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
reply_with_quote_scope to support per-context quote controlreply_with_quote_scope to support per-context quote Control
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.
Description / 描述
此 PR 为引用回复功能增加了“生效范围”控制。目前 AstrBot 的引用回复是全局生效的,而在实际使用中,部分用户希望在私聊中保持简洁,而在群聊中保留引用以维持上下文连贯。
本更改通过引入
reply_with_quote_scope配置项,允许用户在 WebUI 中自由选择:全部开启 (all)、仅群聊开启 (group_only)、或仅私聊开启 (private_only)。Modifications / 改动点
主要改动如下:
补全了 zh-CN 和 en-US 的 config-metadata.json 翻译词条,确保 WebUI 能够正确渲染标签。
This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
由 Sourcery 提供的摘要
为不同会话类型的“引用回复”行为新增可配置的范围控制。
新功能:
reply_with_quote_scope配置项,可将引用回复启用为适用于所有聊天、仅群组、或仅私聊。增强改进:
文档:
Original summary in English
Summary by Sourcery
Add configurable scope control for reply-with-quote behavior across different conversation types.
New Features:
Enhancements:
Documentation: