Show WHY A req failed

This commit is contained in:
Nexus 2024-01-11 14:41:07 +00:00
parent 0095c654cb
commit 609b96c842
2 changed files with 4 additions and 1 deletions

1
.gitignore vendored
View file

@ -6,6 +6,7 @@
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff # User-specific stuff
.idea/
.idea/workspace.xml .idea/workspace.xml
.idea/**/workspace.xml .idea/**/workspace.xml
.idea/**/tasks.xml .idea/**/tasks.xml

View file

@ -36,6 +36,7 @@ class OllamaView(View):
SERVER_KEYS = list(CONFIG["ollama"].keys()) SERVER_KEYS = list(CONFIG["ollama"].keys())
class Ollama(commands.Cog): class Ollama(commands.Cog):
def __init__(self, bot: commands.Bot): def __init__(self, bot: commands.Bot):
self.bot = bot self.bot = bot
@ -71,7 +72,7 @@ class Ollama(commands.Cog):
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, asyncio.TimeoutError): except (aiohttp.ClientConnectionError, asyncio.TimeoutError):
self.log.warning("%r is offline.", url) self.log.warning("%r is offline.", url, exc_info=True)
return False return False
@commands.slash_command() @commands.slash_command()
@ -204,6 +205,7 @@ class Ollama(commands.Cog):
) )
embed.set_footer(text="Using server %r" % server, icon_url=server_config.get("icon_url")) embed.set_footer(text="Using server %r" % server, icon_url=server_config.get("icon_url"))
await ctx.edit(embed=embed) await ctx.edit(embed=embed)
await asyncio.sleep(1)
if await self.check_server(CONFIG["ollama"][server]["base_url"]): if await self.check_server(CONFIG["ollama"][server]["base_url"]):
server_config = CONFIG["ollama"][server] server_config = CONFIG["ollama"][server]
break break