mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 11:14:59 +00:00
refactor: Add SSL verification control to ModelInfoManager
This commit is contained in:
parent
c7b4c22b94
commit
5f147242be
2 changed files with 8 additions and 2 deletions
|
@ -510,6 +510,8 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
|||
litellm._load_litellm()
|
||||
litellm._lazy_module.client_session = httpx.Client(verify=False)
|
||||
litellm._lazy_module.aclient_session = httpx.AsyncClient(verify=False)
|
||||
# Set verify_ssl on the model_info_manager
|
||||
models.model_info_manager.set_verify_ssl(False)
|
||||
|
||||
if args.timeout:
|
||||
models.request_timeout = args.timeout
|
||||
|
|
|
@ -138,7 +138,11 @@ class ModelInfoManager:
|
|||
self.cache_file = self.cache_dir / "model_prices_and_context_window.json"
|
||||
self.content = None
|
||||
self.local_model_metadata = {}
|
||||
self.verify_ssl = True
|
||||
self._load_cache()
|
||||
|
||||
def set_verify_ssl(self, verify_ssl):
|
||||
self.verify_ssl = verify_ssl
|
||||
|
||||
def _load_cache(self):
|
||||
try:
|
||||
|
@ -154,8 +158,8 @@ class ModelInfoManager:
|
|||
try:
|
||||
import requests
|
||||
|
||||
# this needs to respect the --no-verify-ssl switch. ai!
|
||||
response = requests.get(self.MODEL_INFO_URL, timeout=5)
|
||||
# Respect the --no-verify-ssl switch
|
||||
response = requests.get(self.MODEL_INFO_URL, timeout=5, verify=self.verify_ssl)
|
||||
if response.status_code == 200:
|
||||
self.content = response.json()
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue