Skip to content

Commit

Permalink
Fixed Current Model not updating when changing model by bot command
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeyoYT committed Nov 3, 2024
1 parent 5a1e134 commit 1a27368
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ dependencies {
implementation group: 'io.github.freya022', name: 'JDA', version: '70e5e5ca33'
implementation group: 'io.github.cdimascio', name: 'java-dotenv', version: '5.2.2'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.6'
implementation group: 'dev.langchain4j', name: 'langchain4j-ollama', version: '0.33.0'
implementation group: 'dev.langchain4j', name: 'langchain4j-ollama', version: '0.35.0'
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '5.0.0-alpha.14'
implementation group: 'joda-time', name: 'joda-time', version: '2.12.7'
implementation group: 'org.jsoup', name: 'jsoup', version: '1.17.2'

implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.0'

implementation 'dev.langchain4j:langchain4j-easy-rag:0.33.0'
implementation 'dev.langchain4j:langchain4j-easy-rag:0.35.0'

}

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import me.ailama.main.AiLama;
import me.ailama.main.Main;
import me.ailama.tools.*;
import okhttp3.OkHttpClient;
import org.jetbrains.annotations.NotNull;
import org.jsoup.Jsoup;

Expand Down Expand Up @@ -547,18 +548,15 @@ public void setModel(String model, String userId) {

assistants.remove(userId);
createAssistant(model, userId);
this.model = model;
}

public boolean hasModel(String model) {
return getModels().contains(model);
}

public List<String> getModels() {

OllamaModels models = OllamaModels.builder()
.baseUrl(url)
.build();

OllamaModels models = new OllamaModels(url, Duration.ofSeconds(90), 3, false, false);
return models.availableModels().content().stream().map(OllamaModel::getName).toList();
}

Expand Down

0 comments on commit 1a27368

Please sign in to comment.