Automatically switch model to llava when an image is attached
This commit is contained in:
parent
789231f2da
commit
ae065c8d97
1 changed files with 7 additions and 3 deletions
|
@ -146,9 +146,13 @@ class Ollama(commands.Cog):
|
||||||
|
|
||||||
if image:
|
if image:
|
||||||
if fnmatch(model, "llava:*") is False:
|
if fnmatch(model, "llava:*") is False:
|
||||||
await ctx.respond("You can only use images with llava.")
|
await ctx.respond(
|
||||||
return
|
"You can only use images with llava. Switching model to `llava:latest`.",
|
||||||
elif image.size > 1024 * 1024 * 25:
|
delete_after=5
|
||||||
|
)
|
||||||
|
model = "llava:latest"
|
||||||
|
|
||||||
|
if image.size > 1024 * 1024 * 25:
|
||||||
await ctx.respond("Attachment is too large. Maximum size is 25 MB, for sanity. Try compressing it.")
|
await ctx.respond("Attachment is too large. Maximum size is 25 MB, for sanity. Try compressing it.")
|
||||||
return
|
return
|
||||||
elif not fnmatch(image.content_type, "image/*"):
|
elif not fnmatch(image.content_type, "image/*"):
|
||||||
|
|
Loading…
Reference in a new issue