From 5ae5920478300048a039cb07998c33f2bcc31db7 Mon Sep 17 00:00:00 2001 From: Zacharias Date: Thu, 30 Jul 2026 21:24:06 +0200 Subject: [PATCH] Moved versions of the "public facing" modules to the gradle.properties Core: - Fixed my promis of making Core work with multiple OllamaObjects --- API/build.gradle | 2 +- Core/build.gradle | 4 +- .../src/main/java/me/neurodock/core/Core.java | 42 +++++++------------ Plugin-API/build.gradle | 2 +- gradle.properties | 6 ++- 5 files changed, 26 insertions(+), 30 deletions(-) diff --git a/API/build.gradle b/API/build.gradle index ee3ea20..dd4412d 100644 --- a/API/build.gradle +++ b/API/build.gradle @@ -5,7 +5,7 @@ plugins { id 'io.spring.dependency-management' version '1.1.4' } -version = '1.0-SNAPSHOT' +version = APIVersion dependencies { implementation project(":Core") diff --git a/Core/build.gradle b/Core/build.gradle index 0ed5af3..4b061d1 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -2,11 +2,13 @@ plugins { id 'java-library' } -version = '1.10.0' +version = coreVersion dependencies { implementation project(":Plugin-API") api "org.json:json:20250107" + implementation 'org.graalvm.polyglot:polyglot:25.1.3' + implementation 'org.graalvm.polyglot:js:25.1.3' } java { diff --git a/Core/src/main/java/me/neurodock/core/Core.java b/Core/src/main/java/me/neurodock/core/Core.java index cf192d8..7cbee0d 100644 --- a/Core/src/main/java/me/neurodock/core/Core.java +++ b/Core/src/main/java/me/neurodock/core/Core.java @@ -326,25 +326,20 @@ public class Core { * @param ollamaObject The OllamaObject to use */ public void setOllamaObject(OllamaObject ollamaObject) { - if(this.ollamaObject == null) { - this.ollamaObject = ollamaObject; + this.ollamaObject = ollamaObject; - for(Pair tool : ollamaObject.getTools()) { - if(tool.getKey() instanceof OllamaFunctionTool functionTool) - { - funtionTools.add(new Pair<>(functionTool, tool.getValue())); - } + for(Pair tool : ollamaObject.getTools()) { + if(tool.getKey() instanceof OllamaFunctionTool functionTool) + { + funtionTools.add(new Pair<>(functionTool, tool.getValue())); } + } - addTool(new AddMemoryFunction(), Source.CORE); - addTool(new RemoveMemoryFunction(), Source.CORE); - addTool(new GetMemoryFunction(), Source.CORE); - addTool(new GetMemoriesFunction(), Source.CORE); - addTool(new GetMemoryIdentitiesFunction(), Source.CORE); - } - else { - throw new IllegalArgumentException("Ollama object is already set"); - } + addTool(new AddMemoryFunction(), Source.CORE); + addTool(new RemoveMemoryFunction(), Source.CORE); + addTool(new GetMemoryFunction(), Source.CORE); + addTool(new GetMemoriesFunction(), Source.CORE); + addTool(new GetMemoryIdentitiesFunction(), Source.CORE); } /** @@ -353,18 +348,13 @@ public class Core { * @param ollamaObject The OllamaObject to use */ public void setOllamaObjectNoMemory(OllamaObject ollamaObject) { - if(this.ollamaObject == null) { - this.ollamaObject = ollamaObject; - for(Pair tool : ollamaObject.getTools()) { - if(tool.getKey() instanceof OllamaFunctionTool functionTool) - { - funtionTools.add(new Pair<>(functionTool, tool.getValue())); - } + this.ollamaObject = ollamaObject; + for(Pair tool : ollamaObject.getTools()) { + if(tool.getKey() instanceof OllamaFunctionTool functionTool) + { + funtionTools.add(new Pair<>(functionTool, tool.getValue())); } } - else { - throw new IllegalArgumentException("Ollama object is already set"); - } } /** diff --git a/Plugin-API/build.gradle b/Plugin-API/build.gradle index aadf409..9a7e86e 100644 --- a/Plugin-API/build.gradle +++ b/Plugin-API/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java-library' } -version = '0.1.4.1' +version = pluginAPIVersion repositories { mavenCentral() diff --git a/gradle.properties b/gradle.properties index fc9a6ca..13c8b6d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,7 @@ # This is used in sub-project that dosent explicitly require the API sub-project to only include if thay shuld be included project wide. useAPI = true -javaVersion = 25 \ No newline at end of file +javaVersion = 25 + +coreVersion = 1.10.1 +pluginAPIVersion = 0.1.4.1 +APIVersion = 1.0-SNAPSHOT \ No newline at end of file