mirror of
https://github.com/open-webui/open-webui
synced 2024-11-18 14:32:52 +00:00
fix: connection timeout
This commit is contained in:
parent
fa54eb687e
commit
014e52c072
@ -124,8 +124,9 @@ async def cancel_ollama_request(request_id: str, user=Depends(get_current_user))
|
|||||||
|
|
||||||
|
|
||||||
async def fetch_url(url):
|
async def fetch_url(url):
|
||||||
|
timeout = aiohttp.ClientTimeout(total=5)
|
||||||
try:
|
try:
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession(timeout=timeout) as session:
|
||||||
async with session.get(url) as response:
|
async with session.get(url) as response:
|
||||||
return await response.json()
|
return await response.json()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -182,10 +182,11 @@ 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=5)
|
||||||
try:
|
try:
|
||||||
if key != "":
|
if key != "":
|
||||||
headers = {"Authorization": f"Bearer {key}"}
|
headers = {"Authorization": f"Bearer {key}"}
|
||||||
async with aiohttp.ClientSession() as session:
|
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:
|
||||||
return await response.json()
|
return await response.json()
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user