refactor: Remove BeautifulSoup dependency and use regex to strip HTML tags

This commit is contained in:
Stefan Hladnik (aider) 2025-03-18 03:08:57 +07:00 committed by Stefan Hladnik
parent 4600dbcda5
commit 08d48f42ad

View file

@ -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(",", "")