From aed2606601c7e90a775c64c795232529396fe0b3 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Sun, 1 Feb 2026 18:45:20 -0300 Subject: [PATCH] atlasbot: force top hardware line 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 fba135a..120e877 100644 --- a/atlasbot/engine/answerer.py +++ b/atlasbot/engine/answerer.py @@ -513,6 +513,21 @@ class AnswerEngine: if classify.get("question_type") in {"metric", "diagnostic"} and metric_facts: reply = _metric_fact_guard(reply, metric_facts, keyword_tokens) + 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: + reply = f"From the latest snapshot: {hw_top}." + reply = await self._dedup_reply(reply, plan, call_llm, tag="dedup") scores = await self._score_answer(normalized, reply, plan, call_llm)