From 5f433a186bf7b2de352b351afa8d966e4ae203d2 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Sun, 1 Feb 2026 18:41:19 -0300 Subject: [PATCH] atlasbot: force hardware_usage_top for class metrics --- atlasbot/engine/answerer.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/atlasbot/engine/answerer.py b/atlasbot/engine/answerer.py index 4f9130c..fba135a 100644 --- a/atlasbot/engine/answerer.py +++ b/atlasbot/engine/answerer.py @@ -285,6 +285,21 @@ class AnswerEngine: if hardware_facts: metric_facts = hardware_facts key_facts = _merge_fact_lines(metric_facts, key_facts) + if classify.get("question_type") in {"metric", "diagnostic"}: + lowered_q = f"{question} {normalized}".lower() + if any(tok in lowered_q for tok in ("hardware", "class", "type", "rpi", "jetson", "amd64", "arm64")) and any( + tok in lowered_q for tok in ("average", "avg", "mean", "ram", "memory", "cpu", "load") + ): + hw_top = None + for line in summary_lines: + if "hardware_usage_top:" in line: + parts = [seg.strip() for seg in line.split(" | ") if seg.strip().startswith("hardware_usage_top:")] + if parts: + hw_top = parts[0] + break + if hw_top: + metric_facts = [hw_top] + key_facts = _merge_fact_lines(metric_facts, key_facts) if hottest_facts and not hardware_facts: metric_facts = hottest_facts key_facts = _merge_fact_lines(metric_facts, key_facts)