Allow non-orca-mini on other hosts

This commit is contained in:
Nexus 2023-11-13 20:32:59 +00:00
parent 8070fe497e
commit 0f03feeede
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -1899,25 +1899,16 @@ class OtherCog(commands.Cog):
content = None content = None
RESTRICTED_SERVERS = ( RESTRICTED_SERVERS = (
"100.106.34.86:11434" "100.106.34.86:11434",
"100.66.187.46:11434"
) )
try_hosts = { try_hosts = {
"127.0.0.1:11434": "localhost",
"100.106.34.86:11434": "NexTop", "100.106.34.86:11434": "NexTop",
"ollama.shronk.net": "Alibaba Cloud", "ollama.shronk.net": "Alibaba Cloud",
"100.66.187.46:11434": "NexBox", "100.66.187.46:11434": "NexBox",
"100.116.242.161:11434": "PortaPi"
} }
model = model.casefold() model = model.casefold()
if not await self.bot.is_owner(ctx.author):
if not model.startswith("orca-mini"):
await ctx.respond(
":warning: You can only use `orca-mini` models.",
delete_after=30,
ephemeral=True
)
model = "orca-mini"
if server != "auto": if server != "auto":
async with httpx.AsyncClient(follow_redirects=True) as client: async with httpx.AsyncClient(follow_redirects=True) as client:
for host in try_hosts.keys(): for host in try_hosts.keys():
@ -1957,6 +1948,16 @@ class OtherCog(commands.Cog):
host = server host = server
if host in RESTRICTED_SERVERS:
if not await self.bot.is_owner(ctx.author):
if not model.startswith("orca-mini"):
await ctx.respond(
":warning: You can only use `orca-mini` models.",
delete_after=30,
ephemeral=True
)
model = "orca-mini"
embed = discord.Embed( embed = discord.Embed(
colour=discord.Colour.greyple() colour=discord.Colour.greyple()
) )