mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Fix ollama server selector [pt 2]
This commit is contained in:
parent
3e4f7c043e
commit
bc0123be24
2 changed files with 8 additions and 1 deletions
|
@ -504,7 +504,7 @@ class Events(commands.Cog):
|
||||||
content = message.content
|
content = message.content
|
||||||
|
|
||||||
if isinstance(key, str):
|
if isinstance(key, str):
|
||||||
regex = re.compile(key, re.IGNORECASE)
|
regex = re.compile(key.casefold(), re.IGNORECASE)
|
||||||
if not regex.search(content):
|
if not regex.search(content):
|
||||||
continue
|
continue
|
||||||
elif isinstance(key, tuple):
|
elif isinstance(key, tuple):
|
||||||
|
|
|
@ -1938,6 +1938,13 @@ class OtherCog(commands.Cog):
|
||||||
def model_is_allowed(model_name: str, srv: dict[str, str | list[str] | int]) -> bool:
|
def model_is_allowed(model_name: str, srv: dict[str, str | list[str] | int]) -> bool:
|
||||||
for pat in srv.get("allow", ['*']):
|
for pat in srv.get("allow", ['*']):
|
||||||
if not fnmatch.fnmatch(model_name.casefold(), pat.casefold()):
|
if not fnmatch.fnmatch(model_name.casefold(), pat.casefold()):
|
||||||
|
print(
|
||||||
|
"Server %r does not support %r (only %r.)" % (
|
||||||
|
srv['name'],
|
||||||
|
model_name,
|
||||||
|
', '.join(srv['allow'])
|
||||||
|
)
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue