From 164eab56fcc1ed5adc00c6540d0ff6d63ebe9da2 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Sun, 1 Feb 2026 18:36:54 -0300 Subject: [PATCH] atlasbot: fallback metric facts for hardware usage --- atlasbot/engine/answerer.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/atlasbot/engine/answerer.py b/atlasbot/engine/answerer.py index 821a343..4f9130c 100644 --- a/atlasbot/engine/answerer.py +++ b/atlasbot/engine/answerer.py @@ -296,6 +296,18 @@ class AnswerEngine: key_facts = _merge_fact_lines(metric_facts, key_facts) if self._settings.debug_pipeline: _debug_log("metric_facts_selected", {"facts": metric_facts}) + if classify.get("question_type") in {"metric", "diagnostic"} and not metric_facts: + for line in summary_lines: + if "hardware_usage_top:" in line: + metric_facts = [seg.strip() for seg in line.split(" | ") if seg.strip().startswith("hardware_usage_top:")] + break + if not metric_facts: + for line in summary_lines: + if "hardware_usage_avg:" in line: + metric_facts = [seg.strip() for seg in line.split(" | ") if seg.strip().startswith("hardware_usage_avg:")] + break + if metric_facts: + key_facts = _merge_fact_lines(metric_facts, key_facts) if self._settings.debug_pipeline: scored_preview = sorted( [{"id": c["id"], "score": scored.get(c["id"], 0.0), "summary": c["summary"]} for c in chunks],