From c727643e05f3597395ee1a60b17117d04f693a18 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 27 Jul 2026 00:11:59 -0400 Subject: [PATCH] refac --- backend/open_webui/env.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/env.py b/backend/open_webui/env.py index a466456fef..dff1c515b7 100644 --- a/backend/open_webui/env.py +++ b/backend/open_webui/env.py @@ -566,11 +566,14 @@ except (ValueError, TypeError): AIOHTTP_CLIENT_TIMEOUT = 300 # Optional between-chunks idle cap for streaming aiohttp requests. -_stream_idle_timeout_raw = os.getenv('AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT', '') -try: - AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT = int(_stream_idle_timeout_raw) if _stream_idle_timeout_raw else None -except (ValueError, TypeError): +AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT = os.getenv('AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT', '') +if AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT == '': AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT = None +else: + try: + AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT = int(AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT) + except (ValueError, TypeError): + AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT = None if AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT is not None and AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT <= 0: AIOHTTP_CLIENT_STREAM_IDLE_TIMEOUT = None