From ae065c8d979c443c3682a2a69f4b22b245b98dff Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Thu, 11 Jan 2024 13:21:41 +0000 Subject: [PATCH] Automatically switch model to llava when an image is attached --- src/cogs/ollama.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cogs/ollama.py b/src/cogs/ollama.py index 832af12..f8c45b5 100644 --- a/src/cogs/ollama.py +++ b/src/cogs/ollama.py @@ -146,9 +146,13 @@ class Ollama(commands.Cog): if image: if fnmatch(model, "llava:*") is False: - await ctx.respond("You can only use images with llava.") - return - elif image.size > 1024 * 1024 * 25: + await ctx.respond( + "You can only use images with llava. Switching model to `llava:latest`.", + 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.") return elif not fnmatch(image.content_type, "image/*"):