Remove corpus counts from chat chrome

This commit is contained in:
2026-08-10 17:26:58 +07:00
parent 46469468bb
commit 97cb6d16f4
31 changed files with 2192 additions and 424 deletions
+9
View File
@@ -270,6 +270,13 @@ class RetrievalService:
# Excluded from pooling outright rather than trusting a score margin
# that isn't reliably wide enough on its own.
_LEXICAL_POOL_EXCLUDED_SECTIONS = frozenset({"duoc_ly_va_co_che_tac_dung"})
# Cross-section pooling solves one measured semantic mismatch: a
# "thận trọng" question whose decisive condition is filed under
# contraindications. Applying it to every explicit section leaked a
# lexically-overlapping interaction section into a dosage answer. Keep
# this recall expansion opt-in for the one section with evidence for it;
# exact dosage/interaction/contraindication routes remain exact.
_LEXICAL_POOL_ENABLED_SECTIONS = frozenset({"than_trong"})
def _section_hits(self, query: str, drug_id: str) -> list[SearchHit] | None:
"""Hits for an explicitly named section, or None to fall back.
@@ -302,6 +309,8 @@ class RetrievalService:
as into a query-driven check across every section, still bounded and
still whole-section (never a partial, out-of-context fragment).
"""
if resolved_section not in self._LEXICAL_POOL_ENABLED_SECTIONS:
return []
search_lexical = getattr(self._retriever, "search_lexical", None)
if search_lexical is None:
return []