Fix ollama server status checker
This commit is contained in:
parent
09f93c054e
commit
0106311cd3
1 changed files with 3 additions and 3 deletions
|
@ -64,14 +64,14 @@ class Ollama(commands.Cog):
|
||||||
|
|
||||||
async def check_server(self, url: str) -> bool:
|
async def check_server(self, url: str) -> bool:
|
||||||
"""Checks that a server is online and responding."""
|
"""Checks that a server is online and responding."""
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(10)) as session:
|
||||||
self.log.debug("Checking if %r is online.", url)
|
self.log.debug("Checking if %r is online.", url)
|
||||||
try:
|
try:
|
||||||
async with session.get(url) as resp:
|
async with session.get(url + "/api/tags") as resp:
|
||||||
self.log.debug("%r is online.", resp.url.host)
|
self.log.debug("%r is online.", resp.url.host)
|
||||||
return resp.ok
|
return resp.ok
|
||||||
except aiohttp.ClientConnectionError:
|
except aiohttp.ClientConnectionError:
|
||||||
self.log.warning("%r is offline.", resp.url.host)
|
self.log.warning("%r is offline.", url)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@commands.slash_command()
|
@commands.slash_command()
|
||||||
|
|
Loading…
Reference in a new issue