diff --git a/services/comms/scripts/atlasbot/bot.py b/services/comms/scripts/atlasbot/bot.py index a7741cd..739019c 100644 --- a/services/comms/scripts/atlasbot/bot.py +++ b/services/comms/scripts/atlasbot/bot.py @@ -424,9 +424,14 @@ def _detect_operation(q: str) -> str | None: return None def _detect_metric(q: str) -> str | None: + tokens = set(_tokens(q)) for metric, phrases in METRIC_HINTS.items(): - if _has_any(q, phrases): - return metric + for phrase in phrases: + if " " in phrase: + if phrase in q: + return metric + elif phrase in tokens: + return metric return None def _detect_hardware_filters(q: str) -> tuple[set[str], set[str]]: @@ -1249,7 +1254,7 @@ def structured_answer( if missing: msg += f" Missing: {', '.join(missing)}." return _format_confidence(msg, "high") - if not (include_hw or exclude_hw or nodes_in_query or only_workers): + if not (include_hw or exclude_hw or nodes_in_query or only_workers or role_filters): return _format_confidence(f"Atlas has {len(names)} nodes.", "high") return _format_confidence(f"Matching nodes: {len(names)}.", "high")