mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-17 14:55:23 +00:00
enh: tool server data timeout
This commit is contained in:
parent
23dcae7054
commit
fb0ee1329d
2 changed files with 8 additions and 1 deletions
|
|
@ -422,6 +422,11 @@ else:
|
||||||
except Exception:
|
except Exception:
|
||||||
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST = 10
|
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST = 10
|
||||||
|
|
||||||
|
|
||||||
|
AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER_DATA = os.environ.get(
|
||||||
|
"AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER_DATA", "10"
|
||||||
|
)
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# OFFLINE_MODE
|
# OFFLINE_MODE
|
||||||
####################################
|
####################################
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ from langchain_core.utils.function_calling import convert_to_openai_function
|
||||||
from open_webui.models.tools import Tools
|
from open_webui.models.tools import Tools
|
||||||
from open_webui.models.users import UserModel
|
from open_webui.models.users import UserModel
|
||||||
from open_webui.utils.plugin import load_tools_module_by_id
|
from open_webui.utils.plugin import load_tools_module_by_id
|
||||||
|
from open_webui.env import AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER_DATA
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
|
|
@ -399,7 +400,8 @@ async def get_tool_server_data(token: str, url: str) -> Dict[str, Any]:
|
||||||
|
|
||||||
error = None
|
error = None
|
||||||
try:
|
try:
|
||||||
async with aiohttp.ClientSession() as session:
|
timeout = aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER_DATA)
|
||||||
|
async with aiohttp.ClientSession(timeout=timeout) as session:
|
||||||
async with session.get(url, headers=headers) as response:
|
async with session.get(url, headers=headers) as response:
|
||||||
if response.status != 200:
|
if response.status != 200:
|
||||||
error_body = await response.json()
|
error_body = await response.json()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue