From 523e42479438d48638d95e01b9bafcad0bce9212 Mon Sep 17 00:00:00 2001 From: zeyoyt Date: Wed, 28 Aug 2024 21:42:32 +0530 Subject: [PATCH] Added patch, and bot shows error when model is not downloaded --- src/main/java/me/ailama/commands/AiCommand.java | 5 +++++ .../me/ailama/handler/commandhandler/OllamaManager.java | 7 +------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/ailama/commands/AiCommand.java b/src/main/java/me/ailama/commands/AiCommand.java index 4d3df0d..dd53c6e 100644 --- a/src/main/java/me/ailama/commands/AiCommand.java +++ b/src/main/java/me/ailama/commands/AiCommand.java @@ -69,6 +69,11 @@ public void handleCommand(SlashCommandInteractionEvent event) { String userId = event.getUser().getId(); + if(modelOption != null && !OllamaManager.getInstance().hasModel(modelOption)) { + event.getHook().sendMessage("The model you provided is invalid, please provide a valid model").setEphemeral(true).queue(); + return; + } + if(resetSession) { OllamaManager.getInstance().getChatMemory(userId).clear(); } diff --git a/src/main/java/me/ailama/handler/commandhandler/OllamaManager.java b/src/main/java/me/ailama/handler/commandhandler/OllamaManager.java index 6ec4689..3717a7e 100644 --- a/src/main/java/me/ailama/handler/commandhandler/OllamaManager.java +++ b/src/main/java/me/ailama/handler/commandhandler/OllamaManager.java @@ -416,12 +416,7 @@ public AiServices createAssistantX(String modelName) { public Assistant createAssistant(String modelName, String userID) { Assistant assistant = getAssistantFromID(userID); - if(assistant != null && !isTooledAssistant) { - - if(modelName != null && !modelName.equals(model)) { - return createAssistant(modelName, userID); - } - + if(assistant != null && !isTooledAssistant && modelName != null) { return assistant; }