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.
fixes #3063
Motivation / 动机
修复人格预设对话的重复注入问题。
修复人格预设对话
_begin_dialogs_processed
在执行过程中丢失属性_no_save
的问题。Modifications / 改动点
深拷贝Context做备份,避免供应商适配器移除Context内字段(
_no_save
)导致将预设会话存入历史。深拷贝人格预设会话防止运行时被意外修改。
Verification Steps / 验证步骤
新建一个带有预设对话的人格。
进行对话,检查预设对话是否生效。
检查对话数据,里面应当不存在预设对话。
Screenshots or Test Results / 运行截图或测试结果
Compatibility & Breaking Changes / 兼容性与破坏性变更
Checklist / 检查清单
requirements.txt
和pyproject.toml
文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txt
andpyproject.toml
.Sourcery 总结
通过深拷贝对话上下文和预设消息,并在处理后恢复上下文,修复角色预设对话中的重复和属性丢失问题。
错误修复:
_begin_dialogs_processed
消息,以保留_no_save
标志并避免意外的运行时变异。Original summary in English
Summary by Sourcery
Fix duplication and property loss in persona preset dialogues by deep copying conversation contexts and preset messages and restoring contexts after processing
Bug Fixes:
_begin_dialogs_processed
messages to preserve_no_save
flags and avoid unintended runtime mutations