fix: _remove_duplicate_headings usa ventana de 5 líneas en lugar de break
Build & Deploy ResearchOwl / build-and-push (push) Successful in 6s

This commit is contained in:
ChemaVX
2026-05-04 13:19:08 +00:00
parent 6aaa85a1f8
commit 7a012c2c28
+7 -8
View File
@@ -455,14 +455,13 @@ def _remove_duplicate_headings(text: str) -> str:
line = lines[i].rstrip()
if line.startswith('# ') and not line.startswith('## '):
h1_text = line[2:].strip().lower()
prev_heading = ''
for prev in reversed(result):
prev_stripped = prev.strip()
if prev_stripped:
if prev_stripped.startswith('## '):
prev_heading = prev_stripped[3:].strip().lower()
break
if prev_heading and prev_heading == h1_text:
window = result[-5:] if len(result) >= 5 else result[:]
recent_h2s = {
p.strip()[3:].strip().lower()
for p in window
if p.strip().startswith('## ')
}
if h1_text in recent_h2s:
i += 1
continue
result.append(lines[i])