Show the server order in the status description
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 6s
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 6s
This commit is contained in:
parent
ff9894f18f
commit
c400596861
1 changed files with 8 additions and 2 deletions
|
@ -937,13 +937,19 @@ class Ollama(commands.Cog):
|
||||||
embed.colour = discord.Colour.dark_theme()
|
embed.colour = discord.Colour.dark_theme()
|
||||||
return await msg.edit(embed=embed)
|
return await msg.edit(embed=embed)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command(name="ollama-status", aliases=["ollama_status", "os"])
|
||||||
async def ollama_status(self, ctx: commands.Context):
|
async def ollama_status(self, ctx: commands.Context):
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="Ollama server statuses:",
|
title="Ollama server statuses:",
|
||||||
color=discord.Color.blurple(),
|
color=discord.Color.blurple(),
|
||||||
timestamp=discord.utils.utcnow(),
|
timestamp=discord.utils.utcnow(),
|
||||||
)
|
)
|
||||||
|
if CONFIG["ollama"].get("order"):
|
||||||
|
ln = [f"Server order:"]
|
||||||
|
for n, key in enumerate(CONFIG["ollama"].get("order"), start=1):
|
||||||
|
ln.append(f"{n}. {key!r}")
|
||||||
|
embed.description = "\n".join(ln)
|
||||||
|
|
||||||
for server, lock in self.servers.items():
|
for server, lock in self.servers.items():
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name=server,
|
name=server,
|
||||||
|
@ -959,7 +965,7 @@ class Ollama(commands.Cog):
|
||||||
ok = await self.check_server(CONFIG["ollama"][server]["base_url"])
|
ok = await self.check_server(CONFIG["ollama"][server]["base_url"])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
ok = False
|
ok = False
|
||||||
self.log.error("Error while checking server %r: %r", server, e)
|
self.log.error("Error while checking server %r: %r", server, e, exc_info=True)
|
||||||
for field in embed.fields:
|
for field in embed.fields:
|
||||||
if field.name == server:
|
if field.name == server:
|
||||||
field.value = "\U00002705 Online" if ok else "\U0000274c Offline"
|
field.value = "\U00002705 Online" if ok else "\U0000274c Offline"
|
||||||
|
|
Loading…
Reference in a new issue