feat: prefer full hottest line for hotspot questions

This commit is contained in:
Brad Stein 2026-02-02 12:01:05 -03:00
parent d8dc4379a9
commit 8a4ac352cd

View File

@ -308,6 +308,11 @@ class AnswerEngine:
elif hardware_facts: elif hardware_facts:
metric_facts = hardware_facts metric_facts = hardware_facts
key_facts = _merge_fact_lines(metric_facts, key_facts) key_facts = _merge_fact_lines(metric_facts, key_facts)
if any(term in lowered_q for term in ("hot spot", "hotspot", "hot spots", "hotspots")):
hottest_line = next((line for line in summary_lines if line.startswith("hottest:")), None)
if hottest_line:
metric_facts = [hottest_line]
key_facts = _merge_fact_lines(metric_facts, key_facts)
if classify.get("question_type") in {"metric", "diagnostic"}: if classify.get("question_type") in {"metric", "diagnostic"}:
if focus_entity != "node" and any(tok in lowered_q for tok in ("hardware", "class", "type", "rpi", "jetson", "amd64", "arm64")) and any( if focus_entity != "node" and 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") tok in lowered_q for tok in ("average", "avg", "mean", "ram", "memory", "cpu", "load")