atlasbot: steer node focus and pressure facts
This commit is contained in:
parent
eaba83a033
commit
7029aa2beb
@ -274,6 +274,9 @@ class AnswerEngine:
|
||||
keyword_tokens = _extract_keywords(question, normalized, sub_questions=sub_questions, keywords=keywords)
|
||||
focus_entity = str(classify.get("focus_entity") or "unknown").lower()
|
||||
focus_metric = str(classify.get("focus_metric") or "unknown").lower()
|
||||
lowered_q = f"{question} {normalized}".lower()
|
||||
if "node" in lowered_q:
|
||||
focus_entity = "node"
|
||||
|
||||
snapshot_context = ""
|
||||
if classify.get("needs_snapshot"):
|
||||
@ -306,7 +309,6 @@ class AnswerEngine:
|
||||
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 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")
|
||||
):
|
||||
@ -352,6 +354,19 @@ class AnswerEngine:
|
||||
break
|
||||
if metric_facts:
|
||||
key_facts = _merge_fact_lines(metric_facts, key_facts)
|
||||
if ("pressure" in lowered_q or "diskpressure" in lowered_q or "storagepressure" in lowered_q) and not metric_facts:
|
||||
pressure_lines = []
|
||||
for line in summary_lines:
|
||||
line_lower = line.lower()
|
||||
if line_lower.startswith("pressure_summary:") or line_lower.startswith("pressure_nodes:"):
|
||||
pressure_lines.append(line)
|
||||
if "node_pressure" in line_lower or "pvc_pressure" in line_lower:
|
||||
pressure_lines.append(line)
|
||||
if line_lower.startswith("pvc_usage_top:") or line_lower.startswith("root_disk_low_headroom:"):
|
||||
pressure_lines.append(line)
|
||||
if pressure_lines:
|
||||
metric_facts = pressure_lines[:2]
|
||||
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],
|
||||
@ -1270,6 +1285,10 @@ def _metric_candidate_lines(lines: list[str], keywords: list[str] | None, limit:
|
||||
"anomalies",
|
||||
"pvc",
|
||||
"storage",
|
||||
"pressure_summary",
|
||||
"pressure_nodes",
|
||||
"diskpressure",
|
||||
"storagepressure",
|
||||
}
|
||||
candidates: list[str] = []
|
||||
for line in lines:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user