From 64ca67c0517ae275e20549f16ef4890fb22226cc Mon Sep 17 00:00:00 2001 From: Elaina Date: Wed, 22 Apr 2026 01:14:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20=5Factive=5Ftopic?= =?UTF-8?q?=20=E5=9C=A8=E8=AF=9D=E9=A2=98=E5=88=87=E6=8D=A2=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E6=9B=B4=E6=96=B0=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题: _active_topic 只在 continue 时更新,switch 后停留在旧值,导致 overlap 计算失效。 修复: - select() 每次都更新 _active_topic(无论是否切换) - 同步调用 topic_gate.update_active_topic() 保持两份状态一致 同时更新 TopicGate 实例的活跃话题状态,解决两份状态独立的问题。 --- src/gatekeeper.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gatekeeper.py b/src/gatekeeper.py index 05a8f14..660b19d 100644 --- a/src/gatekeeper.py +++ b/src/gatekeeper.py @@ -101,8 +101,10 @@ class ContextGatekeeper: # 如需进一步裁剪,可在 Block 内部按句子级别筛选 # 7. 更新活跃话题 - if not switched and query_anchors: + if query_anchors: 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. 格式化为输出 result = [