Skip to content

Commit

Permalink
Fixed Model Switching in AI Command and Model Command
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeyoYT committed Sep 15, 2024
1 parent 23a71c6 commit b54b6fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/me/ailama/commands/AiCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public void handleCommand(SlashCommandInteractionEvent event) {

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ public AiServices<Assistant> createAssistantX(String modelName) {
public Assistant createAssistant(String modelName, String userID) {

Assistant assistant = getAssistantFromID(userID);
if(assistant != null && !isTooledAssistant && modelName != null) {

if(assistant != null && !isTooledAssistant && modelName == null) {
return assistant;
}

Expand Down Expand Up @@ -529,7 +530,7 @@ public void setModel(String model, String userId) {
}

assistants.remove(userId);
assistants.put(userId, createAssistant(model, userId));
createAssistant(model, userId);
}

public boolean hasModel(String model) {
Expand Down

0 comments on commit b54b6fe

Please sign in to comment.