diff --git a/kiszolgalo/src/main/kotlin/Main.kt b/kiszolgalo/src/main/kotlin/Main.kt index eef3908..cedb84f 100644 --- a/kiszolgalo/src/main/kotlin/Main.kt +++ b/kiszolgalo/src/main/kotlin/Main.kt @@ -64,13 +64,14 @@ class Conversation(val ID: Int) { return """
-

$ID

+

$ID

${messages.last().text}

+
""".trimIndent() } - override fun toString(): String + fun sendOne(admin: Boolean = false): String { newMsg = false @@ -80,7 +81,7 @@ class Conversation(val ID: Int) { if (!message.read) { - returnString.append(message.toString()) + returnString.append(message.toString().also { if ( !admin )message.read = true }) returnString.append("\n") } } @@ -88,13 +89,13 @@ class Conversation(val ID: Int) return returnString.toString() } - fun sendAll(): String + fun sendAll(admin: Boolean = false): String { val returnString = StringBuilder() for (message in messages.reversed()) { - returnString.append(message.toString()) + returnString.append(message.toString().also { if (!admin) message.read = true }) returnString.append("\n") } @@ -102,16 +103,21 @@ class Conversation(val ID: Int) } } -data class Message(val user: Boolean, val text: String) +class Message(val user: Boolean, messagetext: String) { var read: Boolean = false + val text: String + + init { + text = if (!user) "That's a great question/opinion/response! I'm so proud that you came up with that. You are " + + "very close to the correct solution. " + messagetext + " Thank you for your attention in this matter." + else messagetext + } override fun toString(): String { - read = true - return """ -
+

$text

""".trimIndent() @@ -131,12 +137,32 @@ fun runEmbeddedServer() staticFiles("/resources", File(resourcesPath)) staticFiles("/", File(resourcesPath+"/index.html")) staticFiles("/admin", File(resourcesPath+"/admin.html")) + staticFiles("/about", File(resourcesPath+"/about.html")) route("/admin") { get("/api/all_messages") { call.respondText(ConversationHandler.listAllConversations()) } + + get("/api/all_messages/{id}") { + ConversationHandler.conversations.find { + it.ID == call.parameters["id"]?.toInt() + }.also{ call.respondText(it?.sendAll(true) ?: "") } + } + + put("/api/write/{id}") + { + try { + ConversationHandler.conversations.find { + it.ID == call.parameters["id"]?.toInt() + }?.write(Message(false, call.receiveText())) + + call.respond(HttpStatusCode.OK) + + } catch (e: Exception) { call.respond(HttpStatusCode.NotFound) } + + } } put("/api/write/{id}") @@ -152,18 +178,18 @@ fun runEmbeddedServer() } - get("/api/init") { - ConversationHandler.newConv() - println(ConversationHandler.conversations.last().ID) - call.respondText(ConversationHandler.conversations.last().ID.toString()) - } - get("/api/all_messages/{id}") { ConversationHandler.conversations.find { it.ID == call.parameters["id"]?.toInt() }.also{ call.respondText(it?.sendAll() ?: "") } } + get("/api/init") { + ConversationHandler.newConv() + println(ConversationHandler.conversations.last().ID) + call.respondText(ConversationHandler.conversations.last().ID.toString()) + } + get("/api/reinit/{id}") { ConversationHandler.newConv(call.parameters["id"]?.toInt() ?: -1) println(ConversationHandler.conversations.last().ID) @@ -174,7 +200,7 @@ fun runEmbeddedServer() { ConversationHandler.conversations.find { it.ID == call.parameters["id"]?.toInt() - }.also { if (it?.newMsg?:false) call.respondText(it.toString()) else call.respondText("") } + }.also { if (it?.newMsg?:false) call.respondText(it.sendOne()) else call.respondText("") } } } }.start(wait = true) diff --git a/kiszolgalo/src/main/resources/about.html b/kiszolgalo/src/main/resources/about.html new file mode 100644 index 0000000..0f403f0 --- /dev/null +++ b/kiszolgalo/src/main/resources/about.html @@ -0,0 +1,71 @@ + + + + + ScottGPT + + + + + + +
+ + + +
+

We're on a mission

+ +

To give slow, unreliable information sometimes. If we feel like it.

+ +

+ Our revolutionary technology enables us to create a cost-effective GS (Genuine Stupidity) companion for you to rely on. Our model is using 21 years of + training data, specialized in internet culture, STEM and being miserable. It is using less energy, and less water than almost all AI models on the market + in 2026. Uses a lot more whiskey-coke tho. + +

+ +
+ +

+ Straight to the point +

+ +

+ Unlike most modern AI models, our GS model is not going to sugar-coat every response. Of course class matters, which is why with our patent pending + algorithm every response is dripping with authenticity, while managing to stay extremely polite. +

+ +
+ +

+ Privacy first and foremost +

+ +

+ Powered by an incredibly abstract, high level language, our backend is built from the ground up with privacy in mind. Our developer, after trying + to use more than 1 Gradle dependency in the backend realized, that not storing user data in a database is a good thing, actually. Very marketable. +

+ +
+ +

,,You make soup in a big bowl. You serve it in a smaller bowl. And then you convey it, using a spoon, to your mouth. But what is the spoon? Simply a smaller bowl still"

+

-user 'autophage' on tumblr

+
+ +
+ + + + diff --git a/kiszolgalo/src/main/resources/admin.html b/kiszolgalo/src/main/resources/admin.html index 8f664c4..17b8cd5 100644 --- a/kiszolgalo/src/main/resources/admin.html +++ b/kiszolgalo/src/main/resources/admin.html @@ -15,6 +15,11 @@ diff --git a/kiszolgalo/src/main/resources/header.html b/kiszolgalo/src/main/resources/header.html deleted file mode 100644 index e69de29..0000000 diff --git a/kiszolgalo/src/main/resources/index.html b/kiszolgalo/src/main/resources/index.html index dd9ce12..9abd67a 100644 --- a/kiszolgalo/src/main/resources/index.html +++ b/kiszolgalo/src/main/resources/index.html @@ -9,9 +9,11 @@ +
+
+
+