mirror of
https://github.com/open-webui/open-webui
synced 2025-04-08 14:49:46 +00:00
add: OPENAI_MODEL_LIST_TIMEOUT
This commit is contained in:
parent
6f3f5ff922
commit
ebec6cd426
@ -18,7 +18,7 @@ from open_webui.config import (
|
|||||||
OPENAI_API_KEYS,
|
OPENAI_API_KEYS,
|
||||||
AppConfig,
|
AppConfig,
|
||||||
)
|
)
|
||||||
from open_webui.env import AIOHTTP_CLIENT_TIMEOUT
|
from open_webui.env import AIOHTTP_CLIENT_TIMEOUT, OPENAI_MODEL_LIST_TIMEOUT
|
||||||
|
|
||||||
from open_webui.constants import ERROR_MESSAGES
|
from open_webui.constants import ERROR_MESSAGES
|
||||||
from open_webui.env import SRC_LOG_LEVELS
|
from open_webui.env import SRC_LOG_LEVELS
|
||||||
@ -179,7 +179,7 @@ async def speech(request: Request, user=Depends(get_verified_user)):
|
|||||||
|
|
||||||
|
|
||||||
async def fetch_url(url, key):
|
async def fetch_url(url, key):
|
||||||
timeout = aiohttp.ClientTimeout(total=3)
|
timeout = aiohttp.ClientTimeout(total=OPENAI_MODEL_LIST_TIMEOUT)
|
||||||
try:
|
try:
|
||||||
headers = {"Authorization": f"Bearer {key}"}
|
headers = {"Authorization": f"Bearer {key}"}
|
||||||
async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session:
|
async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session:
|
||||||
|
@ -363,6 +363,16 @@ else:
|
|||||||
except Exception:
|
except Exception:
|
||||||
AIOHTTP_CLIENT_TIMEOUT = 300
|
AIOHTTP_CLIENT_TIMEOUT = 300
|
||||||
|
|
||||||
|
OPENAI_MODEL_LIST_TIMEOUT = os.environ.get("OPENAI_MODEL_LIST_TIMEOUT", "")
|
||||||
|
|
||||||
|
if OPENAI_MODEL_LIST_TIMEOUT == "":
|
||||||
|
OPENAI_MODEL_LIST_TIMEOUT = None
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
OPENAI_MODEL_LIST_TIMEOUT = int(OPENAI_MODEL_LIST_TIMEOUT)
|
||||||
|
except Exception:
|
||||||
|
OPENAI_MODEL_LIST_TIMEOUT = 3
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# OFFLINE_MODE
|
# OFFLINE_MODE
|
||||||
####################################
|
####################################
|
||||||
|
Loading…
Reference in New Issue
Block a user