mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
refactor: Lazy-load model cache to respect SSL verification settings
This commit is contained in:
parent
d3ad1fd384
commit
4bac8e2ebe
1 changed files with 9 additions and 1 deletions
|
@ -139,12 +139,15 @@ class ModelInfoManager:
|
|||
self.content = None
|
||||
self.local_model_metadata = {}
|
||||
self.verify_ssl = True
|
||||
self._load_cache()
|
||||
self._cache_loaded = False
|
||||
|
||||
def set_verify_ssl(self, verify_ssl):
|
||||
self.verify_ssl = verify_ssl
|
||||
|
||||
def _load_cache(self):
|
||||
if self._cache_loaded:
|
||||
return
|
||||
|
||||
try:
|
||||
self.cache_dir.mkdir(parents=True, exist_ok=True)
|
||||
if self.cache_file.exists():
|
||||
|
@ -153,6 +156,8 @@ class ModelInfoManager:
|
|||
self.content = json.loads(self.cache_file.read_text())
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
self._cache_loaded = True
|
||||
|
||||
def _update_cache(self):
|
||||
try:
|
||||
|
@ -179,6 +184,9 @@ class ModelInfoManager:
|
|||
if data:
|
||||
return data
|
||||
|
||||
# Ensure cache is loaded before checking content
|
||||
self._load_cache()
|
||||
|
||||
if not self.content:
|
||||
self._update_cache()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue