atlasbot: tighten metric fact matching
This commit is contained in:
parent
8942b41527
commit
7aca249468
@ -2264,7 +2264,11 @@ def _reply_matches_metric_facts(reply: str, metric_facts: list[str]) -> bool:
|
||||
reply_numbers = set(re.findall(r"\d+(?:\\.\d+)?", reply))
|
||||
if not reply_numbers:
|
||||
return False
|
||||
fact_numbers = set(re.findall(r"\d+(?:\\.\d+)?", " ".join(metric_facts)))
|
||||
fact_numbers: set[str] = set()
|
||||
value_pattern = re.compile(r"(?:>=|<=|=|:)\\s*(\\d+(?:\\.\\d+)?)")
|
||||
for line in metric_facts:
|
||||
for match in value_pattern.findall(line):
|
||||
fact_numbers.add(match)
|
||||
if not fact_numbers:
|
||||
return True
|
||||
return bool(reply_numbers & fact_numbers)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user