Extracted the external tool base for python runner
build / build (push) Has been cancelled

Fixed URL building in APITool.java.
Updated libraries for API, Launcher.
Started applying NotNull annotation to methods and arguments in Core.java.
Started handeling the big init block in Core.java.
Added overloaded constructor for Core.java and made Core.ollamaIP a variabled that's definible
Updated Tool.addTool return for 400 error.
This commit is contained in:
2026-05-04 14:23:26 +02:00
parent 943c8470a5
commit 96a6ed169e
9 changed files with 83 additions and 48 deletions
@@ -7,6 +7,7 @@ import me.zacharias.chat.plugin.Plugin;
import me.zacharias.chat.plugin.PluginLoader;
import me.zacharias.chat.plugin.exceptions.PluginLoadingException;
import org.intellij.lang.annotations.MagicConstant;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -54,7 +55,7 @@ public class Core {
/**
* The IP of the Ollama API.
*/
private String ollamaIP = "10.0.1.101";//"192.168.5.184";
private String ollamaIP;
/**
* The port of the Ollama API.
*/
@@ -118,7 +119,12 @@ public class Core {
}
}
{
/**
* This function is pending a better name, as this was introduced from being a generic block. This was ugly, and ideally things here should be refactored more.
*
* TODO: Fix a better name and refactor this method.
*/
private void constructCore(){
File dir = new File("./logs/");
if (!dir.exists()) {
dir.mkdir();
@@ -139,6 +145,7 @@ public class Core {
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
try {
if (logFile.exists()) {
BufferedReader br = new BufferedReader(new FileReader(logFile));
@@ -221,9 +228,28 @@ public class Core {
* Creates a new instance of Core with the provided PrintMessageHandler
* @param printMessageHandler The PrintMessageHandler to use as the default Output
*/
public Core(PrintMessageHandler printMessageHandler) {
public Core(@NotNull PrintMessageHandler printMessageHandler) {
this.printMessageHandler = printMessageHandler;
supportColor = printMessageHandler.color();
ollamaIP = "localhost";
// TODO: This is a dirty way to not have a masisive init block, please check this methods comment.
constructCore();
}
/**
* Creates a new instance of Core with the provided PrintMessageHandler, with a specific IP used for Ollama
* @param printMessageHandler The PrintMessageHandler to use as the default Output
* @param ollamaIP The IP used for the Ollama backend
*/
public Core(@NotNull PrintMessageHandler printMessageHandler, @NotNull String ollamaIP)
{
this.printMessageHandler = printMessageHandler;
supportColor = printMessageHandler.color();
this.ollamaIP = ollamaIP;
// TODO: This is a dirty way to not have a masisive init block, please check this methods comment.
constructCore();
}
/**