From 21cca34392a8bac0bb6ffbc1226a8877578944ad Mon Sep 17 00:00:00 2001 From: "Stefan Hladnik (aider)" Date: Tue, 18 Mar 2025 03:53:27 +0700 Subject: [PATCH] fix: Allow arbitrary characters in model availability check regex --- aider/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/models.py b/aider/models.py index dc55e0a8a..fe92e8aa5 100644 --- a/aider/models.py +++ b/aider/models.py @@ -246,10 +246,10 @@ class ModelInfoManager: if response.status_code != 200: return {} html = response.text - if f'The model "{url_part}" is not available' in html: + import re + if re.search(rf'The model\s*.*{re.escape(url_part)}.* is not available', html, re.IGNORECASE): print(f"Error: Model '{url_part}' is not available") sys.exit(1) - import re text = re.sub(r'<[^>]+>', ' ', html) context_match = re.search(r"([\d,]+)\s*context", text) if context_match: