fix: show knowledge excerpts when Gemma abstains

This commit is contained in:
Hamza Ayed
2026-10-04 11:07:46 +03:00
parent 76567d4b47
commit 2e06ae3cc7
7 changed files with 140 additions and 0 deletions
@@ -255,6 +255,7 @@ class AgentSkillTests(unittest.TestCase):
"text": "The SQLite migration adds selected_version to old messages and preserves saved assistant answer versions.",
}
refusal = "لم يتم العثور على مقاطع تجيب مباشرة على السؤال في فهرس المعرفة المحلي."
live_refusal = 'لا يوجد مقطع في فهرس المعرفة المحلي يجيب مباشرة على السؤال "How are old conversation answers migrated?".'
with (
patch(
"app.main._search_local_knowledge",
@@ -280,6 +281,7 @@ class AgentSkillTests(unittest.TestCase):
citation_only = "المقطع `routing.md`, المقطع 0."
self.assertTrue(_is_knowledge_answer_insufficient(refusal))
self.assertTrue(_is_knowledge_answer_insufficient(live_refusal))
self.assertTrue(_is_knowledge_answer_insufficient(citation_only))
self.assertFalse(_is_knowledge_answer_insufficient("تضيف الهجرة selected_version."))
self.assertIn("لم يصغ النموذج جوابًا كافيًا رغم وجود نتائج", result["result"])