mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 12:45:00 +00:00
refactor: Remove BeautifulSoup dependency and use regex to strip HTML tags
This commit is contained in:
parent
4600dbcda5
commit
08d48f42ad
1 changed files with 1 additions and 3 deletions
|
@ -246,10 +246,8 @@ class ModelInfoManager:
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
return {}
|
return {}
|
||||||
html = response.text
|
html = response.text
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
soup = BeautifulSoup(html, "html.parser")
|
|
||||||
text = soup.get_text()
|
|
||||||
import re
|
import re
|
||||||
|
text = re.sub(r'<[^>]+>', ' ', html)
|
||||||
context_match = re.search(r"([\d,]+)\s*context", text)
|
context_match = re.search(r"([\d,]+)\s*context", text)
|
||||||
if context_match:
|
if context_match:
|
||||||
context_str = context_match.group(1).replace(",", "")
|
context_str = context_match.group(1).replace(",", "")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue