fix: 合并判断模型上下文数量配置#23
Open
Sisyphbaous-DT-Project wants to merge 2 commits into
Open
Conversation
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.
修改内容
修复
judge_context_count配置未按文案生效的问题,并合并重复的上下文数量配置。主要改动:
context_messages_count。judge_context_count控制判断模型参考的最近聊天记录数量。context_messages_count,取judge_context_count和旧值的最大值,避免老用户升级后历史窗口变小。judge_context_count <= 0时可能误取全量历史的问题。问题原因
旧版本中,
judge_context_count在配置页面显示为“传入判断模型的上下文条数”,但实际判断历史数量主要由context_messages_count控制,导致配置项文案和实际行为不一致。同时,判断模型调用时已经把最近聊天记录写入 prompt,又额外通过
contexts传入历史。AstrBot Provider 会将 prompt 追加到 contexts,因此存在重复上下文风险。兼容性
保留对旧配置
context_messages_count的临时兼容读取,并取新旧两个配置值的最大值,避免已有用户升级后判断模型参考的历史条数减少。测试情况
judge_context_count正常控制 prompt 中的最近聊天记录数量。judge_context_count = 0时不会误取全量历史。contexts为空,不再重复传入上下文。