Open
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The default values for
context_promptandactive_reply_suffix_promptare now hardcoded both indefault.pyand as.get(..., default)values inlong_term_memory.py; consider relying on the config defaults only to avoid divergence if one side is changed later. - In
ChatProviderTemplate’sschemadefinition,provider_ltm_settings.active_reply_suffix_promptappears to be nested inside theprovider_ltm_settings.active_replyblock; please double-check the brace/indent structure so thatactive_reply_suffix_promptis defined at the intended level and the condition applies correctly in the dashboard.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The default values for `context_prompt` and `active_reply_suffix_prompt` are now hardcoded both in `default.py` and as `.get(..., default)` values in `long_term_memory.py`; consider relying on the config defaults only to avoid divergence if one side is changed later.
- In `ChatProviderTemplate`’s `schema` definition, `provider_ltm_settings.active_reply_suffix_prompt` appears to be nested inside the `provider_ltm_settings.active_reply` block; please double-check the brace/indent structure so that `active_reply_suffix_prompt` is defined at the intended level and the condition applies correctly in the dashboard.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces configurable prompts for long-term memory and active replies, replacing hardcoded strings with context_prompt and active_reply_suffix_prompt. The changes span the core logic, default settings, and dashboard localization. A critical syntax error was identified in astrbot/core/config/default.py, where the new configuration metadata is incorrectly nested within the whitelist dictionary, resulting in a malformed structure that will cause a Python syntax error.
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.
群聊上下文感知功能的提示词此前均为硬编码,用户无法根据自己的 Bot 人格或语言风格进行调整。
Modifications / 改动点
astrbot/core/config/default.py:在 provider_ltm_settings 下新增两个可配置字段:
context_prompt:上下文感知提示词(引导 LLM 理解聊天记录的前缀,普通模式与主动回复模式均生效)
active_reply_suffix_prompt:主动回复后缀提示词(主动回复模式下追加在消息末尾的指令,仅主动回复启用时在
Dashboard 中显示)
astrbot/builtin_stars/astrbot/long_term_memory.py:从 配置读取上述字段,替换原有硬编码字符串
dashboard/src/i18n/locales/zh-CNen-US/features/confi g-metadata.json:新增对应 i18n 翻译
This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Make group chat long-term memory prompts configurable and expose them in the provider settings UI.
New Features:
Enhancements:
Documentation: