From 08d48f42ad6c826ad108d5d3becef2c602c27fe3 Mon Sep 17 00:00:00 2001 From: "Stefan Hladnik (aider)" Date: Tue, 18 Mar 2025 03:08:57 +0700 Subject: [PATCH] refactor: Remove BeautifulSoup dependency and use regex to strip HTML tags --- aider/models.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/aider/models.py b/aider/models.py index 108dd9a97..28bc05f85 100644 --- a/aider/models.py +++ b/aider/models.py @@ -246,10 +246,8 @@ class ModelInfoManager: if response.status_code != 200: return {} html = response.text - from bs4 import BeautifulSoup - soup = BeautifulSoup(html, "html.parser") - text = soup.get_text() import re + text = re.sub(r'<[^>]+>', ' ', html) context_match = re.search(r"([\d,]+)\s*context", text) if context_match: context_str = context_match.group(1).replace(",", "")