From 241b9c9738f0ad4b8b11cdbfb047ebb2e617fd82 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 13 Oct 2023 11:25:10 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=EF=B8=8F=20trust=5Fenv=3DTrue=20fo?= =?UTF-8?q?r=20proxy=20env=20var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/continuedev/core/sdk.py | 10 +++++----- server/continuedev/libs/llm/base.py | 3 +++ server/continuedev/libs/llm/together.py | 1 + server/continuedev/libs/util/devdata.py | 2 +- server/continuedev/plugins/context_providers/google.py | 2 +- server/continuedev/server/meilisearch_server.py | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/server/continuedev/core/sdk.py b/server/continuedev/core/sdk.py index da5a074d2..ffb545dca 100644 --- a/server/continuedev/core/sdk.py +++ b/server/continuedev/core/sdk.py @@ -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) diff --git a/server/continuedev/libs/llm/base.py b/server/continuedev/libs/llm/base.py index 96679d884..f95cb38e1 100644 --- a/server/continuedev/libs/llm/base.py +++ b/server/continuedev/libs/llm/base.py @@ -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]: diff --git a/server/continuedev/libs/llm/together.py b/server/continuedev/libs/llm/together.py index 4187595ca..234834125 100644 --- a/server/continuedev/libs/llm/together.py +++ b/server/continuedev/libs/llm/together.py @@ -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): diff --git a/server/continuedev/libs/util/devdata.py b/server/continuedev/libs/util/devdata.py index 61b4351d5..5db523356 100644 --- a/server/continuedev/libs/util/devdata.py +++ b/server/continuedev/libs/util/devdata.py @@ -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}"}, diff --git a/server/continuedev/plugins/context_providers/google.py b/server/continuedev/plugins/context_providers/google.py index 852f4e9af..37786e8a8 100644 --- a/server/continuedev/plugins/context_providers/google.py +++ b/server/continuedev/plugins/context_providers/google.py @@ -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() diff --git a/server/continuedev/server/meilisearch_server.py b/server/continuedev/server/meilisearch_server.py index a33fefabb..091db1bee 100644 --- a/server/continuedev/server/meilisearch_server.py +++ b/server/continuedev/server/meilisearch_server.py @@ -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")