From 0106311cd3c1312b012c68fd40094893c6b3428a Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Thu, 11 Jan 2024 13:32:41 +0000 Subject: [PATCH] Fix ollama server status checker --- src/cogs/ollama.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cogs/ollama.py b/src/cogs/ollama.py index 56b3eb7..eb3d201 100644 --- a/src/cogs/ollama.py +++ b/src/cogs/ollama.py @@ -64,14 +64,14 @@ class Ollama(commands.Cog): async def check_server(self, url: str) -> bool: """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) 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) return resp.ok except aiohttp.ClientConnectionError: - self.log.warning("%r is offline.", resp.url.host) + self.log.warning("%r is offline.", url) return False @commands.slash_command()