atlasbot: prioritize focused key facts
This commit is contained in:
parent
387eea1399
commit
71d2829d0f
@ -877,13 +877,24 @@ def _key_fact_lines(lines: list[str], keywords: list[str] | None, limit: int = 6
|
||||
lowered = [kw.lower() for kw in keywords if kw]
|
||||
if not lowered:
|
||||
return []
|
||||
focused = _focused_keywords(lowered)
|
||||
primary = focused or lowered
|
||||
matches: list[str] = []
|
||||
for line in lines:
|
||||
line_lower = line.lower()
|
||||
if any(kw in line_lower for kw in lowered):
|
||||
if any(kw in line_lower for kw in primary):
|
||||
matches.append(line)
|
||||
if len(matches) >= limit:
|
||||
break
|
||||
if len(matches) < limit and focused:
|
||||
for line in lines:
|
||||
if len(matches) >= limit:
|
||||
break
|
||||
if line in matches:
|
||||
continue
|
||||
line_lower = line.lower()
|
||||
if any(kw in line_lower for kw in lowered):
|
||||
matches.append(line)
|
||||
return matches
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user