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() line = lines[i].rstrip()
if line.startswith('# ') and not line.startswith('## '): if line.startswith('# ') and not line.startswith('## '):
h1_text = line[2:].strip().lower() h1_text = line[2:].strip().lower()
prev_heading = '' window = result[-5:] if len(result) >= 5 else result[:]
for prev in reversed(result): recent_h2s = {
prev_stripped = prev.strip() p.strip()[3:].strip().lower()
if prev_stripped: for p in window
if prev_stripped.startswith('## '): if p.strip().startswith('## ')
prev_heading = prev_stripped[3:].strip().lower() }
break if h1_text in recent_h2s:
if prev_heading and prev_heading == h1_text:
i += 1 i += 1
continue continue
result.append(lines[i]) result.append(lines[i])