mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 18:54:59 +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.content = None
|
||||||
self.local_model_metadata = {}
|
self.local_model_metadata = {}
|
||||||
self.verify_ssl = True
|
self.verify_ssl = True
|
||||||
self._load_cache()
|
self._cache_loaded = False
|
||||||
|
|
||||||
def set_verify_ssl(self, verify_ssl):
|
def set_verify_ssl(self, verify_ssl):
|
||||||
self.verify_ssl = verify_ssl
|
self.verify_ssl = verify_ssl
|
||||||
|
|
||||||
def _load_cache(self):
|
def _load_cache(self):
|
||||||
|
if self._cache_loaded:
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.cache_dir.mkdir(parents=True, exist_ok=True)
|
self.cache_dir.mkdir(parents=True, exist_ok=True)
|
||||||
if self.cache_file.exists():
|
if self.cache_file.exists():
|
||||||
|
@ -153,6 +156,8 @@ class ModelInfoManager:
|
||||||
self.content = json.loads(self.cache_file.read_text())
|
self.content = json.loads(self.cache_file.read_text())
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
self._cache_loaded = True
|
||||||
|
|
||||||
def _update_cache(self):
|
def _update_cache(self):
|
||||||
try:
|
try:
|
||||||
|
@ -179,6 +184,9 @@ class ModelInfoManager:
|
||||||
if data:
|
if data:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
# Ensure cache is loaded before checking content
|
||||||
|
self._load_cache()
|
||||||
|
|
||||||
if not self.content:
|
if not self.content:
|
||||||
self._update_cache()
|
self._update_cache()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue