🔒️ trust_env=True for proxy env var

This commit is contained in:
Nate Sesti 2023-10-13 11:25:10 -07:00
parent f4fd0cf2ac
commit 241b9c9738
6 changed files with 12 additions and 8 deletions

View file

@ -85,7 +85,7 @@ class ContinueSDK(AbstractContinueSDK):
msg_step = MessageStep(
name="Invalid Continue Config File", message=formatted_err
)
msg_step.description = f"Falling back to default config settings due to the following error in `~/.continue/config.py`.\n```\n{formatted_err}\n```\n\nIt's possible this was caused by an update to the Continue config format. If you'd like to see the new recommended default `config.py`, check [here](https://github.com/continuedev/continue/blob/main/continuedev/src/continuedev/libs/constants/default_config.py).\n\nIf the error is related to OpenAIServerInfo, see the updated way of using these parameters [here](https://continue.dev/docs/customization#azure-openai-service)."
msg_step.description = f"Falling back to default config settings due to the following error in `~/.continue/config.py`.\n```\n{formatted_err}\n```\n\nIt's possible this was caused by an update to the Continue config format. If you'd like to see the new recommended default `config.py`, check [here](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/constants/default_config.py)."
self.history.add_node(
HistoryNode(step=msg_step, observation=None, depth=0, active=False)
)
@ -282,11 +282,11 @@ class ContinueSDK(AbstractContinueSDK):
async def add_context_item(self, item: ContextItem):
await self.__autopilot.context_manager.manually_add_context_item(item)
async def delete_context_item(self, id: ContextItemId):
await self.__autopilot.delete_context_with_ids([
f"{id.provider_title}-{id.item_id}"
])
await self.__autopilot.delete_context_with_ids(
[f"{id.provider_title}-{id.item_id}"]
)
def set_loading_message(self, message: str):
# self.__autopilot.set_loading_message(message)

View file

@ -223,6 +223,7 @@ class LLM(ContinueBaseModel):
connector=aiohttp.TCPConnector(verify_ssl=False),
timeout=aiohttp.ClientTimeout(total=self.timeout),
headers=self.headers,
trust_env=True,
)
else:
ca_bundle_path = (
@ -234,6 +235,7 @@ class LLM(ContinueBaseModel):
connector=aiohttp.TCPConnector(ssl_context=ssl_context),
timeout=aiohttp.ClientTimeout(total=self.timeout),
headers=self.headers,
trust_env=True,
)
else:
logger.warning(
@ -243,6 +245,7 @@ class LLM(ContinueBaseModel):
return aiohttp.ClientSession(
timeout=aiohttp.ClientTimeout(total=self.timeout),
headers=self.headers,
trust_env=True,
)
def collect_args(self, options: CompletionOptions) -> Dict[str, Any]:

View file

@ -52,6 +52,7 @@ class TogetherLLM(LLM):
self._client_session = aiohttp.ClientSession(
connector=aiohttp.TCPConnector(verify_ssl=self.verify_ssl),
timeout=aiohttp.ClientTimeout(total=self.timeout),
trust_env=True,
)
async def stop(self):

View file

@ -27,7 +27,7 @@ class DevDataLogger:
if self.user_token is None or self.data_server_url is None:
return
async with aiohttp.ClientSession() as session:
async with aiohttp.ClientSession(trust_env=True) as session:
await session.post(
f"{self.data_server_url}/event",
headers={"Authorization": f"Bearer {self.user_token}"},

View file

@ -44,7 +44,7 @@ class GoogleContextProvider(ContextProvider):
payload = json.dumps({"q": query})
headers = {"X-API-KEY": self.serper_api_key, "Content-Type": "application/json"}
async with aiohttp.ClientSession() as session:
async with aiohttp.ClientSession(trust_env=True) as session:
async with session.post(url, headers=headers, data=payload) as response:
return await response.text()

View file

@ -15,7 +15,7 @@ from ..libs.util.paths import getMeilisearchExePath, getServerFolderPath
async def download_file(url: str, filename: str):
async with aiohttp.ClientSession() as session:
async with aiohttp.ClientSession(trust_env=True) as session:
async with session.get(url) as resp:
if resp.status == 200:
f = await aiofiles.open(filename, mode="wb")