fix(agent): remove redundant whitespace and truncation logic from browser fetch

This commit is contained in:
2026-10-27 20:38:07 -03:00
parent 2a50b26f4a
commit fe8070edb8
3 changed files with 20 additions and 8 deletions
-8
View File
@@ -467,14 +467,6 @@ def _fetch_page_with_browser(url: str, max_chars: int = _BROWSER_FETCH_MAX_CHARS
except Exception as e:
print(f"[BROWSER] FAILED url={url} err={type(e).__name__}: {e}")
return ""
# Clean up whitespace
lines = [line.strip() for line in text.splitlines() if line.strip()]
cleaned = "\n".join(lines)
# Remove excessive repeated sections that come from navigation menus
if len(cleaned) > max_chars:
cleaned = cleaned[:max_chars] + "..."
print(f"[BROWSER] ok url={url} chars={len(cleaned)}")
return cleaned
except ImportError:
# Playwright not installed, return empty to let caller use fallback
return ""