mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
cleanup
This commit is contained in:
parent
ba7656bc1c
commit
2817766cf5
1 changed files with 11 additions and 13 deletions
|
@ -638,7 +638,6 @@ class ModelInfoManager:
|
||||||
"model_prices_and_context_window.json"
|
"model_prices_and_context_window.json"
|
||||||
)
|
)
|
||||||
CACHE_TTL = 60 * 60 * 24 # 24 hours
|
CACHE_TTL = 60 * 60 * 24 # 24 hours
|
||||||
content = None
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.cache_dir = Path.home() / ".aider" / "caches"
|
self.cache_dir = Path.home() / ".aider" / "caches"
|
||||||
|
@ -657,19 +656,18 @@ class ModelInfoManager:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _update_cache(self):
|
def _update_cache(self):
|
||||||
if not litellm._lazy_module:
|
try:
|
||||||
try:
|
import requests
|
||||||
import requests
|
|
||||||
|
|
||||||
response = requests.get(self.MODEL_INFO_URL, timeout=5)
|
response = requests.get(self.MODEL_INFO_URL, timeout=5)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
self.content = response.json()
|
self.content = response.json()
|
||||||
try:
|
try:
|
||||||
self.cache_file.write_text(json.dumps(self.content, indent=4))
|
self.cache_file.write_text(json.dumps(self.content, indent=4))
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print(str(ex))
|
print(str(ex))
|
||||||
|
|
||||||
def get_model_from_cached_json_db(self, model):
|
def get_model_from_cached_json_db(self, model):
|
||||||
if not self.content:
|
if not self.content:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue