atlasbot: enforce metric facts

This commit is contained in:
Brad Stein 2026-02-01 05:17:53 -03:00
parent a8e9bc53de
commit 387eea1399

View File

@ -405,7 +405,7 @@ class AnswerEngine:
model=plan.model,
tag="focus_fix",
)
if classify.get("question_type") in {"metric", "diagnostic"} and metric_facts and not re.search(r"\\d", reply):
if classify.get("question_type") in {"metric", "diagnostic"} and metric_facts:
best_line = None
lowered_keywords = [kw.lower() for kw in keyword_tokens if kw]
for line in metric_facts:
@ -414,7 +414,10 @@ class AnswerEngine:
best_line = line
break
best_line = best_line or metric_facts[0]
reply = f"From the latest snapshot: {best_line}."
reply_numbers = set(re.findall(r"\\d+(?:\\.\\d+)?", reply))
fact_numbers = set(re.findall(r"\\d+(?:\\.\\d+)?", " ".join(metric_facts)))
if not reply_numbers or (fact_numbers and not (reply_numbers & fact_numbers)):
reply = f"From the latest snapshot: {best_line}."
if plan.use_critic:
if observer: