atlasbot: extract hottest facts from segment lines
This commit is contained in:
parent
7029aa2beb
commit
774fb24296
@ -1204,7 +1204,18 @@ def _extract_hottest_facts(lines: list[str], question: str) -> list[str]:
|
|||||||
return []
|
return []
|
||||||
if "node" not in lowered and "nodes" not in lowered:
|
if "node" not in lowered and "nodes" not in lowered:
|
||||||
return []
|
return []
|
||||||
line = next((item for item in lines if item.lower().startswith("hottest:")), "")
|
line = ""
|
||||||
|
for item in lines:
|
||||||
|
if item.lower().startswith("hottest:"):
|
||||||
|
line = item
|
||||||
|
break
|
||||||
|
if " | " in item:
|
||||||
|
for seg in [seg.strip() for seg in item.split(" | ")]:
|
||||||
|
if seg.lower().startswith("hottest:"):
|
||||||
|
line = seg
|
||||||
|
break
|
||||||
|
if line:
|
||||||
|
break
|
||||||
if not line:
|
if not line:
|
||||||
return []
|
return []
|
||||||
facts = _expand_hottest_line(line)
|
facts = _expand_hottest_line(line)
|
||||||
@ -1291,11 +1302,16 @@ def _metric_candidate_lines(lines: list[str], keywords: list[str] | None, limit:
|
|||||||
"storagepressure",
|
"storagepressure",
|
||||||
}
|
}
|
||||||
candidates: list[str] = []
|
candidates: list[str] = []
|
||||||
|
expanded: list[str] = []
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
if " | " in line:
|
||||||
|
expanded.extend([seg.strip() for seg in line.split(" | ") if seg.strip()])
|
||||||
|
expanded.append(line)
|
||||||
|
for line in expanded:
|
||||||
if line.lower().startswith("hottest:"):
|
if line.lower().startswith("hottest:"):
|
||||||
candidates.extend(_expand_hottest_line(line))
|
candidates.extend(_expand_hottest_line(line))
|
||||||
break
|
break
|
||||||
for line in lines:
|
for line in expanded:
|
||||||
line_lower = line.lower()
|
line_lower = line.lower()
|
||||||
if line_lower.startswith("lexicon_") or line_lower.startswith("units:"):
|
if line_lower.startswith("lexicon_") or line_lower.startswith("units:"):
|
||||||
continue
|
continue
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user