fix: honor hotspot summary selection
This commit is contained in:
parent
8a4ac352cd
commit
3d7e32b810
@ -302,17 +302,13 @@ class AnswerEngine:
|
||||
hardware_facts = [seg.strip() for seg in line.split(" | ") if seg.strip().startswith("hardware_usage_avg:")]
|
||||
break
|
||||
metric_facts = [line for line in key_facts if re.search(r"\d", line)]
|
||||
hotspot_request = any(term in lowered_q for term in ("hot spot", "hotspot", "hot spots", "hotspots"))
|
||||
if focus_entity == "node" and hottest_facts:
|
||||
metric_facts = hottest_facts
|
||||
key_facts = _merge_fact_lines(metric_facts, key_facts)
|
||||
elif hardware_facts:
|
||||
metric_facts = hardware_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 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")
|
||||
@ -327,7 +323,7 @@ class AnswerEngine:
|
||||
if hw_top:
|
||||
metric_facts = [hw_top]
|
||||
key_facts = _merge_fact_lines(metric_facts, key_facts)
|
||||
if hottest_facts and not hardware_facts and focus_entity != "class":
|
||||
if hottest_facts and not hardware_facts and focus_entity != "class" and not hotspot_request:
|
||||
metric_facts = hottest_facts
|
||||
key_facts = _merge_fact_lines(metric_facts, key_facts)
|
||||
if classify.get("question_type") in {"metric", "diagnostic"} and not hottest_facts and not hardware_facts:
|
||||
@ -372,6 +368,11 @@ class AnswerEngine:
|
||||
if pressure_lines:
|
||||
metric_facts = pressure_lines[:2]
|
||||
key_facts = _merge_fact_lines(metric_facts, key_facts)
|
||||
if hotspot_request:
|
||||
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 self._settings.debug_pipeline:
|
||||
scored_preview = sorted(
|
||||
[{"id": c["id"], "score": scored.get(c["id"], 0.0), "summary": c["summary"]} for c in chunks],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user