放宽最近上下文到30条并取消中途截断
This commit is contained in:
@@ -852,7 +852,16 @@ class AIAutoResponsePlugin(MessagePluginInterface):
|
||||
"最近上下文",
|
||||
self._join_recent_messages(
|
||||
context,
|
||||
max_lines=int(prompt_strategy.get("recent_message_max_lines", 4) or 4),
|
||||
# 这里优先走 prompt_strategy,是为了让“给模型看多少条最近消息”由策略层统一控制;
|
||||
# 如果策略层没有明确给值,再退回配置里的 recent_message_max_lines,
|
||||
# 避免出现“配置已经改成 30,但这里还偷偷按 4 条截断”的问题。
|
||||
max_lines=int(
|
||||
prompt_strategy.get(
|
||||
"recent_message_max_lines",
|
||||
self.prompt_compact_config.get("recent_message_max_lines", 30),
|
||||
)
|
||||
or 30
|
||||
),
|
||||
max_line_chars=int(self.prompt_compact_config.get("recent_message_line_max_chars", 60) or 60),
|
||||
),
|
||||
),
|
||||
@@ -1052,7 +1061,19 @@ class AIAutoResponsePlugin(MessagePluginInterface):
|
||||
# 3. 群事实和向量记忆只在问答场景打开,避免模型把记忆写进每句闲聊。
|
||||
target_reply_chars_map = {"social_short": 10, "qa_fast": 16, "qa_with_context": 24}
|
||||
hard_reply_cap_map = {"social_short": 12, "qa_fast": 18, "qa_with_context": 28}
|
||||
recent_lines_map = {"social_short": 4, "qa_fast": 5, "qa_with_context": 6}
|
||||
# 最近消息条数不再按模式缩到 4~6 条,而是统一交给模型看完整窗口:
|
||||
# 1. 回复仍然走短句限制,避免“上下文多了,回复也跟着变长”;
|
||||
# 2. 但模型理解当前讨论时,需要看到完整现场,尤其是多人连续接话场景;
|
||||
# 3. 默认读取 prompt_compact.recent_message_max_lines,这样配置和策略不会打架。
|
||||
configured_recent_lines = max(
|
||||
int(self.prompt_compact_config.get("recent_message_max_lines", 30) or 30),
|
||||
1,
|
||||
)
|
||||
recent_lines_map = {
|
||||
"social_short": configured_recent_lines,
|
||||
"qa_fast": configured_recent_lines,
|
||||
"qa_with_context": configured_recent_lines,
|
||||
}
|
||||
|
||||
allow_member_memory = strong_directed or is_followup or returning_state in {"returning_member", "long_absent_member"}
|
||||
allow_social_memory = is_question_like and strong_directed
|
||||
|
||||
Reference in New Issue
Block a user