atlasbot: force top hardware line for class metrics
This commit is contained in:
parent
5f433a186b
commit
aed2606601
@ -513,6 +513,21 @@ class AnswerEngine:
|
|||||||
if classify.get("question_type") in {"metric", "diagnostic"} and metric_facts:
|
if classify.get("question_type") in {"metric", "diagnostic"} and metric_facts:
|
||||||
reply = _metric_fact_guard(reply, metric_facts, keyword_tokens)
|
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")
|
reply = await self._dedup_reply(reply, plan, call_llm, tag="dedup")
|
||||||
|
|
||||||
scores = await self._score_answer(normalized, reply, plan, call_llm)
|
scores = await self._score_answer(normalized, reply, plan, call_llm)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user