Unverified Commit 94ebf027 authored by mindspawn's avatar mindspawn Committed by GitHub
Browse files

Enable http_proxy use for openai calls.

parent 11bb1a6f
...@@ -186,7 +186,7 @@ async def fetch_url(url, key): ...@@ -186,7 +186,7 @@ async def fetch_url(url, key):
timeout = aiohttp.ClientTimeout(total=5) timeout = aiohttp.ClientTimeout(total=5)
try: try:
headers = {"Authorization": f"Bearer {key}"} headers = {"Authorization": f"Bearer {key}"}
async with aiohttp.ClientSession(timeout=timeout) as session: async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session:
async with session.get(url, headers=headers) as response: async with session.get(url, headers=headers) as response:
return await response.json() return await response.json()
except Exception as e: except Exception as e:
...@@ -462,7 +462,7 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)): ...@@ -462,7 +462,7 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
streaming = False streaming = False
try: try:
session = aiohttp.ClientSession() session = aiohttp.ClientSession(trust_env=True)
r = await session.request( r = await session.request(
method=request.method, method=request.method,
url=target_url, url=target_url,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment