diff --git a/atlasbot/engine/answerer.py b/atlasbot/engine/answerer.py index 6682660..5c57365 100644 --- a/atlasbot/engine/answerer.py +++ b/atlasbot/engine/answerer.py @@ -1059,10 +1059,24 @@ def _extract_hardware_usage_facts(lines: list[str], question: str) -> list[str]: return [] if not any(term in lowered for term in ("average", "avg", "mean", "load", "cpu", "ram", "memory")): return [] + avg_line = None + top_line = None for line in lines: if line.startswith("hardware_usage_avg:"): - return [line] - return [] + avg_line = line + elif line.startswith("hardware_usage_top:"): + top_line = line + if not avg_line and not top_line: + return [] + wants_top = any(term in lowered for term in ("highest", "lowest", "most", "least", "top", "worst", "best")) + if wants_top and top_line: + return [top_line] + facts: list[str] = [] + if avg_line: + facts.append(avg_line) + if top_line: + facts.append(top_line) + return facts def _metric_candidate_lines(lines: list[str], keywords: list[str] | None, limit: int = 40) -> list[str]: diff --git a/atlasbot/llm/prompts.py b/atlasbot/llm/prompts.py index c65dbf4..d3c0cee 100644 --- a/atlasbot/llm/prompts.py +++ b/atlasbot/llm/prompts.py @@ -36,6 +36,7 @@ ROUTE_PROMPT = ( DECOMPOSE_SYSTEM = ( CLUSTER_SYSTEM + " Break complex questions into smaller, answerable sub-questions. " + + "If the question compares hardware classes or node types, include all classes mentioned in context; do not assume only rpi4/rpi5. " + "Return JSON only." )