mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
feat: AIOHTTP_CLIENT_SESSION_SSL
This commit is contained in:
parent
840dd9c89a
commit
eb80719cf0
@ -409,6 +409,11 @@ else:
|
|||||||
except Exception:
|
except Exception:
|
||||||
AIOHTTP_CLIENT_TIMEOUT = 300
|
AIOHTTP_CLIENT_TIMEOUT = 300
|
||||||
|
|
||||||
|
|
||||||
|
AIOHTTP_CLIENT_SESSION_SSL = (
|
||||||
|
os.environ.get("AIOHTTP_CLIENT_SESSION_SSL", "True").lower() == "true"
|
||||||
|
)
|
||||||
|
|
||||||
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST = os.environ.get(
|
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST = os.environ.get(
|
||||||
"AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST",
|
"AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST",
|
||||||
os.environ.get("AIOHTTP_CLIENT_TIMEOUT_OPENAI_MODEL_LIST", "10"),
|
os.environ.get("AIOHTTP_CLIENT_TIMEOUT_OPENAI_MODEL_LIST", "10"),
|
||||||
|
@ -54,6 +54,7 @@ from open_webui.config import (
|
|||||||
from open_webui.env import (
|
from open_webui.env import (
|
||||||
ENV,
|
ENV,
|
||||||
SRC_LOG_LEVELS,
|
SRC_LOG_LEVELS,
|
||||||
|
AIOHTTP_CLIENT_SESSION_SSL,
|
||||||
AIOHTTP_CLIENT_TIMEOUT,
|
AIOHTTP_CLIENT_TIMEOUT,
|
||||||
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST,
|
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST,
|
||||||
BYPASS_MODEL_ACCESS_CONTROL,
|
BYPASS_MODEL_ACCESS_CONTROL,
|
||||||
@ -91,6 +92,7 @@ async def send_get_request(url, key=None, user: UserModel = None):
|
|||||||
else {}
|
else {}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
ssl=AIOHTTP_CLIENT_SESSION_SSL,
|
||||||
) as response:
|
) as response:
|
||||||
return await response.json()
|
return await response.json()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -141,6 +143,7 @@ async def send_post_request(
|
|||||||
else {}
|
else {}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
ssl=AIOHTTP_CLIENT_SESSION_SSL,
|
||||||
)
|
)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|
||||||
@ -234,6 +237,7 @@ async def verify_connection(
|
|||||||
else {}
|
else {}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
ssl=AIOHTTP_CLIENT_SESSION_SSL,
|
||||||
) as r:
|
) as r:
|
||||||
if r.status != 200:
|
if r.status != 200:
|
||||||
detail = f"HTTP Error: {r.status}"
|
detail = f"HTTP Error: {r.status}"
|
||||||
@ -1482,7 +1486,9 @@ async def download_file_stream(
|
|||||||
timeout = aiohttp.ClientTimeout(total=600) # Set the timeout
|
timeout = aiohttp.ClientTimeout(total=600) # Set the timeout
|
||||||
|
|
||||||
async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session:
|
async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session:
|
||||||
async with session.get(file_url, headers=headers) as response:
|
async with session.get(
|
||||||
|
file_url, headers=headers, ssl=AIOHTTP_CLIENT_SESSION_SSL
|
||||||
|
) as response:
|
||||||
total_size = int(response.headers.get("content-length", 0)) + current_size
|
total_size = int(response.headers.get("content-length", 0)) + current_size
|
||||||
|
|
||||||
with open(file_path, "ab+") as file:
|
with open(file_path, "ab+") as file:
|
||||||
|
@ -21,6 +21,7 @@ from open_webui.config import (
|
|||||||
CACHE_DIR,
|
CACHE_DIR,
|
||||||
)
|
)
|
||||||
from open_webui.env import (
|
from open_webui.env import (
|
||||||
|
AIOHTTP_CLIENT_SESSION_SSL,
|
||||||
AIOHTTP_CLIENT_TIMEOUT,
|
AIOHTTP_CLIENT_TIMEOUT,
|
||||||
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST,
|
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST,
|
||||||
ENABLE_FORWARD_USER_INFO_HEADERS,
|
ENABLE_FORWARD_USER_INFO_HEADERS,
|
||||||
@ -74,6 +75,7 @@ async def send_get_request(url, key=None, user: UserModel = None):
|
|||||||
else {}
|
else {}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
ssl=AIOHTTP_CLIENT_SESSION_SSL,
|
||||||
) as response:
|
) as response:
|
||||||
return await response.json()
|
return await response.json()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -481,6 +483,7 @@ async def get_models(
|
|||||||
else {}
|
else {}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
ssl=AIOHTTP_CLIENT_SESSION_SSL,
|
||||||
) as r:
|
) as r:
|
||||||
if r.status != 200:
|
if r.status != 200:
|
||||||
# Extract response error details if available
|
# Extract response error details if available
|
||||||
@ -561,6 +564,7 @@ async def verify_connection(
|
|||||||
else {}
|
else {}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
ssl=AIOHTTP_CLIENT_SESSION_SSL,
|
||||||
) as r:
|
) as r:
|
||||||
if r.status != 200:
|
if r.status != 200:
|
||||||
# Extract response error details if available
|
# Extract response error details if available
|
||||||
@ -723,6 +727,7 @@ async def generate_chat_completion(
|
|||||||
else {}
|
else {}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
ssl=AIOHTTP_CLIENT_SESSION_SSL,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check if response is SSE
|
# Check if response is SSE
|
||||||
@ -802,6 +807,7 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
|
|||||||
else {}
|
else {}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
ssl=AIOHTTP_CLIENT_SESSION_SSL,
|
||||||
)
|
)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user