fix: 修复 _active_topic 在话题切换后不更新的 bug

问题: _active_topic 只在 continue 时更新,switch 后停留在旧值,导致 overlap 计算失效。

修复:
- select() 每次都更新 _active_topic(无论是否切换)
- 同步调用 topic_gate.update_active_topic() 保持两份状态一致

同时更新 TopicGate 实例的活跃话题状态,解决两份状态独立的问题。
This commit is contained in:
Elaina
2026-04-22 01:14:13 +08:00
parent bbaab47de4
commit 64ca67c051

View File

@@ -101,8 +101,10 @@ class ContextGatekeeper:
# 如需进一步裁剪,可在 Block 内部按句子级别筛选 # 如需进一步裁剪,可在 Block 内部按句子级别筛选
# 7. 更新活跃话题 # 7. 更新活跃话题
if not switched and query_anchors: if query_anchors:
self._active_topic = (query_anchors, self.anchor_extractor._idf_cache) self._active_topic = (query_anchors, self.anchor_extractor._idf_cache)
if not switched and query_anchors:
self.topic_gate.update_active_topic(query_anchors, self.anchor_extractor._idf_cache)
# 8. 格式化为输出 # 8. 格式化为输出
result = [ result = [