diff --git a/src/cogs/ollama.py b/src/cogs/ollama.py index c9c251e..c5c90d7 100644 --- a/src/cogs/ollama.py +++ b/src/cogs/ollama.py @@ -487,7 +487,9 @@ class Ollama(commands.Cog): """Checks that a server is online and responding.""" if url in SERVER_KEYS: url = CONFIG["ollama"][url]["base_url"] - async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(10)) as session: + async with aiohttp.ClientSession( + timeout=aiohttp.ClientTimeout(connect=3, sock_connect=3, sock_read=10, total=3) + ) as session: self.log.info("Checking if %r is online.", url) try: async with session.get(url + "/api/tags") as resp: @@ -550,7 +552,11 @@ class Ollama(commands.Cog): if query == "$": v = PromptSelector(ctx) - await ctx.respond("Select edit your prompts, as desired. Click done when you want to continue.", view=v) + await ctx.respond( + "Select edit your prompts, as desired. Click done when you want to continue.", + view=v, + ephemeral=True + ) await v.wait() query = v.user_prompt or query system_query = v.system_prompt @@ -606,7 +612,7 @@ class Ollama(commands.Cog): async with aiohttp.ClientSession( base_url=server_config["base_url"], - timeout=aiohttp.ClientTimeout(connect=30, sock_read=10800, sock_connect=30, total=10830), + timeout=aiohttp.ClientTimeout(connect=5, sock_read=10800, sock_connect=5, total=10830), ) as session: embed = discord.Embed( title="Checking server...", @@ -992,7 +998,6 @@ class Ollama(commands.Cog): ) msg = await ctx.reply(embed=embed) - last_edit = time.time() tasks = {} for server in self.servers.keys():