From 6abcd39837c5c852a1bed454ecc0f81b4d4526e0 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Tue, 27 Aug 2024 14:05:52 +0200 Subject: [PATCH] initial commit sorry for no commit yesterday --- .gitignore | 38 +++++++++++++++++++ .idea/.gitignore | 4 ++ .idea/encodings.xml | 7 ++++ .idea/misc.xml | 14 +++++++ .idea/vcs.xml | 6 +++ README.md | 7 ++++ pom.xml | 25 ++++++++++++ src/main/java/eu/m724/Main.java | 12 ++++++ src/main/java/eu/m724/chat/Chat.java | 5 +++ src/main/java/eu/m724/chat/ChatMessage.java | 8 ++++ .../eu/m724/responsesource/ChatResponse.java | 6 +++ .../responsesource/ChatResponseSource.java | 7 ++++ .../ChatResponseSourceInfo.java | 20 ++++++++++ 13 files changed, 159 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml create mode 100644 README.md create mode 100644 pom.xml create mode 100644 src/main/java/eu/m724/Main.java create mode 100644 src/main/java/eu/m724/chat/Chat.java create mode 100644 src/main/java/eu/m724/chat/ChatMessage.java create mode 100644 src/main/java/eu/m724/responsesource/ChatResponse.java create mode 100644 src/main/java/eu/m724/responsesource/ChatResponseSource.java create mode 100644 src/main/java/eu/m724/responsesource/ChatResponseSourceInfo.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..934cab5 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,4 @@ +# Default ignored files +/shelf/ +/workspace.xml +/uiDesigner.xml \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..7ace097 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..299472e --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +This is a Java library you can write scripts for to support an api with conversational language models + +The scripts are written in Groovy because it's powerful, but I'm thinking about other languages like Lua (which has not many features but I think some can be added) + +Right now there is no sandboxing so every script has access to what this library has access + +Don't take everything I wrote here for granted because I still have to think about how to make this stuff \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..76f9835 --- /dev/null +++ b/pom.xml @@ -0,0 +1,25 @@ + + + 4.0.0 + + eu.m724 + chatapi + 1.0-SNAPSHOT + + + 21 + 21 + UTF-8 + + + + + org.apache.groovy + groovy + 4.0.22 + + + + \ No newline at end of file diff --git a/src/main/java/eu/m724/Main.java b/src/main/java/eu/m724/Main.java new file mode 100644 index 0000000..c8f937e --- /dev/null +++ b/src/main/java/eu/m724/Main.java @@ -0,0 +1,12 @@ +package eu.m724; + +import groovy.lang.GroovyShell; + +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + GroovyShell shell = new GroovyShell(); + Object result = shell.evaluate("2 + 2"); + System.out.println(result); + } +} \ No newline at end of file diff --git a/src/main/java/eu/m724/chat/Chat.java b/src/main/java/eu/m724/chat/Chat.java new file mode 100644 index 0000000..861b939 --- /dev/null +++ b/src/main/java/eu/m724/chat/Chat.java @@ -0,0 +1,5 @@ +package eu.m724.chat; + +public class Chat { + +} diff --git a/src/main/java/eu/m724/chat/ChatMessage.java b/src/main/java/eu/m724/chat/ChatMessage.java new file mode 100644 index 0000000..5cd6c04 --- /dev/null +++ b/src/main/java/eu/m724/chat/ChatMessage.java @@ -0,0 +1,8 @@ +package eu.m724.chat; + +public interface ChatMessage { + boolean isStreaming(); + + String getContent(); + +} diff --git a/src/main/java/eu/m724/responsesource/ChatResponse.java b/src/main/java/eu/m724/responsesource/ChatResponse.java new file mode 100644 index 0000000..5b3b17a --- /dev/null +++ b/src/main/java/eu/m724/responsesource/ChatResponse.java @@ -0,0 +1,6 @@ +package eu.m724.responsesource; + +public interface ChatResponse { + boolean isStreaming(); + // TODO +} diff --git a/src/main/java/eu/m724/responsesource/ChatResponseSource.java b/src/main/java/eu/m724/responsesource/ChatResponseSource.java new file mode 100644 index 0000000..9835f73 --- /dev/null +++ b/src/main/java/eu/m724/responsesource/ChatResponseSource.java @@ -0,0 +1,7 @@ +package eu.m724.responsesource; + +public interface ChatResponseSource { + ChatResponseSourceInfo info(); + + ChatResponse +} diff --git a/src/main/java/eu/m724/responsesource/ChatResponseSourceInfo.java b/src/main/java/eu/m724/responsesource/ChatResponseSourceInfo.java new file mode 100644 index 0000000..948b460 --- /dev/null +++ b/src/main/java/eu/m724/responsesource/ChatResponseSourceInfo.java @@ -0,0 +1,20 @@ +package eu.m724.responsesource; + +public class ChatResponseSourceInfo { + public final String name; + public final String author; + public final String versionName; + public final int version; + + public ChatResponseSourceInfo( + String name, + String author, + String versionName, + int version + ) { + this.name = name; + this.author = author; + this.versionName = versionName; + this.version = version; + } +}