From a0eec99f9f92c3aad512c1748fafc92f46add808 Mon Sep 17 00:00:00 2001 From: Zacharias Date: Fri, 21 Feb 2025 00:04:28 +0100 Subject: [PATCH] Added -h --help to launcher arguments Added a detailed README renamed the module `luancher` to `launcher` --- .idea/gradle.xml | 2 +- README.md | 34 +++++++++++++++++++ build.gradle | 1 + {luancher => launcher}/build.gradle | 6 ++++ .../me/zacharias/chat/launcher}/Launcher.java | 20 +++++++++-- settings.gradle | 2 +- 6 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 README.md rename {luancher => launcher}/build.gradle (62%) rename {luancher/src/main/java/me/zacharias/chat/luancher => launcher/src/main/java/me/zacharias/chat/launcher}/Launcher.java (68%) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 48c153e..f449e21 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -12,7 +12,7 @@ diff --git a/README.md b/README.md new file mode 100644 index 0000000..a99d9fd --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# Chat thing +(better name pending probably) + +## What is it? +Well it's basically a font end for Ollama like [Open-WebUI](https://openwebui.com/), but meant to run a local model and open up a somewhat easy to use API system for tools. + +## Use cases? +While the primary goal is providing a somewhat more modular frontend for Ollama, you can also use this system to integrate AI into your own application, For example AI could act as a player in a game or interact with external system with the use of tools via the API + +simple examples are in the Display module where i gave it the ability to access python through docker and get the current date and time both with the [OllamaFunctionTool](https://server.4zellen.se:3000/Zacharias/chat_thing/src/branch/master/Core/src/main/java/me/zacharias/chat/ollama/OllamaFuntionTool.java) thru my Ollama framework + +## API +The documentation for the API is available at the gitea wiki under [API docs](https://server.4zellen.se:3000/Zacharias/chat_thing/wiki/API-Docs) + +## How to run? +To run you need to build the `launcher` module
+`$ ./gradlew :launcher:shadowJar`
+This will put the `launcher-1.0-all.jar`(or similar, based on the version) in `./launcher/build/libs`, this can now be copied anywhere and can be ran with
+`$ java -jar launcher-1.0-all.jar`
+you can use the `-h` argument to get a help message. +``` +Launch options for AI_chat +-h --help Provides this help message +-s --server Starts the application as API server +-p --port Provides the port number that the API server shuld use, defaults to 39075 +-o --output Redirects the API Server output to another file + --api Provides API docs +``` + +If you only want to build the `Display` or `API` module you can use the same command but replace `launcher` with the desire module.
+- API: `$ ./gradlew :API:shadowJar` +- Display: `$ ./gradlew :Display:shadowJar` +- Core: `$ ./gradlew :Core:shadowJar` + - However this one is kinda useless unless you want to directly implement the system into your application \ No newline at end of file diff --git a/build.gradle b/build.gradle index 8ebdeae..7bfaa0b 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ allprojects { subprojects { apply plugin: 'java' + apply plugin: 'com.gradleup.shadow' dependencies { implementation("org.json:json:20250107") diff --git a/luancher/build.gradle b/launcher/build.gradle similarity index 62% rename from luancher/build.gradle rename to launcher/build.gradle index 6754add..426c970 100644 --- a/luancher/build.gradle +++ b/launcher/build.gradle @@ -8,4 +8,10 @@ version = '1.0-SNAPSHOT' dependencies { implementation project(":Display") implementation project(":API") +} + +jar{ + manifest { + attributes 'Main-Class': 'me.zacharias.chat.launcher.Launcher' + } } \ No newline at end of file diff --git a/luancher/src/main/java/me/zacharias/chat/luancher/Launcher.java b/launcher/src/main/java/me/zacharias/chat/launcher/Launcher.java similarity index 68% rename from luancher/src/main/java/me/zacharias/chat/luancher/Launcher.java rename to launcher/src/main/java/me/zacharias/chat/launcher/Launcher.java index 8d9b8d6..b354d69 100644 --- a/luancher/src/main/java/me/zacharias/chat/luancher/Launcher.java +++ b/launcher/src/main/java/me/zacharias/chat/launcher/Launcher.java @@ -1,4 +1,4 @@ -package me.zacharias.chat.luancher; +package me.zacharias.chat.launcher; import me.zacharias.chat.api.APIServer; import me.zacharias.chat.display.Display; @@ -35,7 +35,23 @@ public class Launcher { System.out.println("API available at https://server.4zellen.se:3000/Zacharias/chat_thing/wiki/API-Docs"); return; } - default -> System.out.println("Unknown argument: " + arg); + case "--help", "-h" -> { + System.out.println(""" + Launch options for AI_chat + -h --help Provides this help message + -s --server Starts the application as API server + -p --port Provides the port number that the API server shuld use, defaults to 39075 + -o --output Redirects the API Server output to another file + --api Provides API docs + """); + return; + } + + default -> { + System.out.println("Unknown option: " + arg+"\nUse --help for help"); + return; + } + } } diff --git a/settings.gradle b/settings.gradle index 29e44a1..dcd3864 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,3 @@ rootProject.name = 'AI-test' -include 'API', 'Core', 'Display', 'luancher' +include 'API', 'Core', 'Display', 'launcher'