fix: clean hotspot replies and hide helper tags
This commit is contained in:
parent
3d7e32b810
commit
36596b51cb
@ -288,6 +288,7 @@ class AnswerEngine:
|
|||||||
key_facts = _key_fact_lines(summary_lines, keyword_tokens)
|
key_facts = _key_fact_lines(summary_lines, keyword_tokens)
|
||||||
hottest_facts = _extract_hottest_facts(summary_lines, f"{question} {normalized}")
|
hottest_facts = _extract_hottest_facts(summary_lines, f"{question} {normalized}")
|
||||||
hardware_facts = _extract_hardware_usage_facts(summary_lines, f"{question} {normalized}")
|
hardware_facts = _extract_hardware_usage_facts(summary_lines, f"{question} {normalized}")
|
||||||
|
hotspot_line = next((line for line in summary_lines if line.startswith("hottest:")), None)
|
||||||
if not hardware_facts:
|
if not hardware_facts:
|
||||||
hardware_tokens = ("hardware", "class", "type", "rpi", "jetson", "amd64", "arm64")
|
hardware_tokens = ("hardware", "class", "type", "rpi", "jetson", "amd64", "arm64")
|
||||||
lowered_q = f"{question} {normalized}".lower()
|
lowered_q = f"{question} {normalized}".lower()
|
||||||
@ -368,11 +369,9 @@ class AnswerEngine:
|
|||||||
if pressure_lines:
|
if pressure_lines:
|
||||||
metric_facts = pressure_lines[:2]
|
metric_facts = pressure_lines[:2]
|
||||||
key_facts = _merge_fact_lines(metric_facts, key_facts)
|
key_facts = _merge_fact_lines(metric_facts, key_facts)
|
||||||
if hotspot_request:
|
if hotspot_request and hotspot_line:
|
||||||
hottest_line = next((line for line in summary_lines if line.startswith("hottest:")), None)
|
metric_facts = [hotspot_line]
|
||||||
if hottest_line:
|
key_facts = _merge_fact_lines(metric_facts, key_facts)
|
||||||
metric_facts = [hottest_line]
|
|
||||||
key_facts = _merge_fact_lines(metric_facts, key_facts)
|
|
||||||
if self._settings.debug_pipeline:
|
if self._settings.debug_pipeline:
|
||||||
scored_preview = sorted(
|
scored_preview = sorted(
|
||||||
[{"id": c["id"], "score": scored.get(c["id"], 0.0), "summary": c["summary"]} for c in chunks],
|
[{"id": c["id"], "score": scored.get(c["id"], 0.0), "summary": c["summary"]} for c in chunks],
|
||||||
@ -560,6 +559,9 @@ class AnswerEngine:
|
|||||||
if note:
|
if note:
|
||||||
reply = f"{reply}\n\n{note}"
|
reply = f"{reply}\n\n{note}"
|
||||||
|
|
||||||
|
if hotspot_request and hotspot_line:
|
||||||
|
reply = f"Current hotspots: {hotspot_line}."
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,8 @@ CLUSTER_SYSTEM = (
|
|||||||
"If a fact is not in context, say you do not know. "
|
"If a fact is not in context, say you do not know. "
|
||||||
"Be conversational and grounded. "
|
"Be conversational and grounded. "
|
||||||
"Avoid commands unless the user asks for them. "
|
"Avoid commands unless the user asks for them. "
|
||||||
"Do not mention the context or knowledge base unless asked."
|
"Do not mention the context or knowledge base unless asked. "
|
||||||
|
"Never repeat helper tags or scaffolding labels (e.g., MustUseFacts, AllowedNodes, AllowedNamespaces, KeyFacts, ClusterSnapshot, SnapshotSummary)."
|
||||||
)
|
)
|
||||||
|
|
||||||
NORMALIZE_SYSTEM = (
|
NORMALIZE_SYSTEM = (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user