Wire up query history: localStorage session persistence + sidebar UI

This commit is contained in:
2026-08-14 17:44:36 +07:00
parent 9be5819710
commit 057d4ed9dc
23 changed files with 1231 additions and 30 deletions
+21
View File
@@ -99,6 +99,27 @@ def test_out_of_scope_turn_type_abstains():
assert reply.reason == "out_of_scope"
def test_out_of_scope_price_question_states_the_book_does_not_have_it():
"""Regression: found live 2026-08-14 that a price question and a
genuinely off-topic question ("thời tiết Hà Nội hôm nay?") got the exact
same vague message, which never actually says Dược thư has no pricing
data at all — it read as "maybe in an appendix not digitized yet"."""
agent = _agent(QueryFrame(turn_type="out_of_scope"))
reply = agent.handle("Paracetamol giá bao nhiêu tiền một hộp?")
assert reply.decision == "abstain"
assert reply.reason == "out_of_scope"
assert "không chứa" in reply.answer.lower()
def test_out_of_scope_offtopic_question_states_supported_scope():
agent = _agent(QueryFrame(turn_type="out_of_scope"))
reply = agent.handle("Thời tiết Hà Nội hôm nay thế nào?")
assert reply.decision == "abstain"
assert reply.reason == "out_of_scope"
assert "giá bán" not in reply.answer
assert "Dược thư" in reply.answer
def test_veterinary_phrase_abstains_even_if_the_model_missed_it():
# The model returned an ordinary-looking frame; the keyword backstop
# (`rag.policy.looks_non_human`, the same one F-02 wired server-side)