Skip to content

Commit a3238aa

Browse files
committed
refac
1 parent 108a019 commit a3238aa

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

backend/open_webui/env.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,16 @@ def parse_section(section):
760760
os.environ.get('AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL', 'True').lower() == 'true'
761761
)
762762

763+
AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER = os.environ.get('AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER', '')
764+
765+
if AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER == '':
766+
AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER = AIOHTTP_CLIENT_TIMEOUT
767+
else:
768+
try:
769+
AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER = int(AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER)
770+
except Exception:
771+
AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER = AIOHTTP_CLIENT_TIMEOUT
772+
763773

764774
RAG_EMBEDDING_TIMEOUT = os.environ.get('RAG_EMBEDDING_TIMEOUT', '')
765775

backend/open_webui/utils/tools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from open_webui.config import BYPASS_ADMIN_ACCESS_CONTROL
4646
from open_webui.env import (
4747
AIOHTTP_CLIENT_TIMEOUT,
48+
AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER,
4849
AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER_DATA,
4950
AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL,
5051
ENABLE_FORWARD_USER_INFO_HEADERS,
@@ -1187,6 +1188,7 @@ async def get_tool_servers_data(servers: List[Dict[str, Any]]) -> List[Dict[str,
11871188
return results
11881189

11891190

1191+
11901192
async def execute_tool_server(
11911193
url: str,
11921194
headers: Dict[str, str],
@@ -1258,7 +1260,7 @@ async def execute_tool_server(
12581260
body_params = params
12591261

12601262
async with aiohttp.ClientSession(
1261-
trust_env=True, timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT)
1263+
trust_env=True, timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER)
12621264
) as session:
12631265
request_method = getattr(session, http_method.lower())
12641266

0 commit comments

Comments
 (0)