sok dolog
This commit is contained in:
@@ -64,13 +64,14 @@ class Conversation(val ID: Int)
|
|||||||
{
|
{
|
||||||
return """
|
return """
|
||||||
<div class="conversation">
|
<div class="conversation">
|
||||||
<p style="flex-grow: 1; background: ">$ID</p>
|
<p style="flex-grow: 1;">$ID</p>
|
||||||
<p style="flex-grow: 9;">${messages.last().text}</p>
|
<p style="flex-grow: 9;">${messages.last().text}</p>
|
||||||
|
<button style="flex-grow: 1;" onclick="open_message($ID)">reply</button>
|
||||||
<div>
|
<div>
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String
|
fun sendOne(admin: Boolean = false): String
|
||||||
{
|
{
|
||||||
newMsg = false
|
newMsg = false
|
||||||
|
|
||||||
@@ -80,7 +81,7 @@ class Conversation(val ID: Int)
|
|||||||
{
|
{
|
||||||
if (!message.read)
|
if (!message.read)
|
||||||
{
|
{
|
||||||
returnString.append(message.toString())
|
returnString.append(message.toString().also { if ( !admin )message.read = true })
|
||||||
returnString.append("\n")
|
returnString.append("\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,13 +89,13 @@ class Conversation(val ID: Int)
|
|||||||
return returnString.toString()
|
return returnString.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendAll(): String
|
fun sendAll(admin: Boolean = false): String
|
||||||
{
|
{
|
||||||
val returnString = StringBuilder()
|
val returnString = StringBuilder()
|
||||||
|
|
||||||
for (message in messages.reversed())
|
for (message in messages.reversed())
|
||||||
{
|
{
|
||||||
returnString.append(message.toString())
|
returnString.append(message.toString().also { if (!admin) message.read = true })
|
||||||
returnString.append("\n")
|
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
|
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
|
override fun toString(): String
|
||||||
{
|
{
|
||||||
read = true
|
|
||||||
|
|
||||||
return """
|
return """
|
||||||
<div class="message-${if (user) "user" else "scott"}">
|
<div class="message message-${if (user) "user" else "scott"}">
|
||||||
<p>$text</p>
|
<p>$text</p>
|
||||||
</div>
|
</div>
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
@@ -131,12 +137,32 @@ fun runEmbeddedServer()
|
|||||||
staticFiles("/resources", File(resourcesPath))
|
staticFiles("/resources", File(resourcesPath))
|
||||||
staticFiles("/", File(resourcesPath+"/index.html"))
|
staticFiles("/", File(resourcesPath+"/index.html"))
|
||||||
staticFiles("/admin", File(resourcesPath+"/admin.html"))
|
staticFiles("/admin", File(resourcesPath+"/admin.html"))
|
||||||
|
staticFiles("/about", File(resourcesPath+"/about.html"))
|
||||||
|
|
||||||
route("/admin")
|
route("/admin")
|
||||||
{
|
{
|
||||||
get("/api/all_messages") {
|
get("/api/all_messages") {
|
||||||
call.respondText(ConversationHandler.listAllConversations())
|
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}")
|
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}") {
|
get("/api/all_messages/{id}") {
|
||||||
ConversationHandler.conversations.find {
|
ConversationHandler.conversations.find {
|
||||||
it.ID == call.parameters["id"]?.toInt()
|
it.ID == call.parameters["id"]?.toInt()
|
||||||
}.also{ call.respondText(it?.sendAll() ?: "") }
|
}.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}") {
|
get("/api/reinit/{id}") {
|
||||||
ConversationHandler.newConv(call.parameters["id"]?.toInt() ?: -1)
|
ConversationHandler.newConv(call.parameters["id"]?.toInt() ?: -1)
|
||||||
println(ConversationHandler.conversations.last().ID)
|
println(ConversationHandler.conversations.last().ID)
|
||||||
@@ -174,7 +200,7 @@ fun runEmbeddedServer()
|
|||||||
{
|
{
|
||||||
ConversationHandler.conversations.find {
|
ConversationHandler.conversations.find {
|
||||||
it.ID == call.parameters["id"]?.toInt()
|
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)
|
}.start(wait = true)
|
||||||
|
|||||||
71
kiszolgalo/src/main/resources/about.html
Normal file
71
kiszolgalo/src/main/resources/about.html
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>ScottGPT</title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="/resources/favicon.ico">
|
||||||
|
<link rel="stylesheet" href="/resources/style.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="main-flexbox">
|
||||||
|
|
||||||
|
<header class="navbar">
|
||||||
|
<a href="https://sc0tt.org/" style="float: left" target="_blank">Sc0tt főoldal</a>
|
||||||
|
<a href="/resources/about.html" style="float: left">About</a>
|
||||||
|
|
||||||
|
<img src="resources/logo.png" alt=logo" style="float: right;">
|
||||||
|
|
||||||
|
<a href="javascript:void(0);"
|
||||||
|
class="icon"
|
||||||
|
onclick="toggleMenu()">
|
||||||
|
☰
|
||||||
|
</a>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="about-content">
|
||||||
|
<h1>We're on a mission</h1>
|
||||||
|
|
||||||
|
<h2>To give slow, unreliable information sometimes. If we feel like it.</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
Straight to the point
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
Privacy first and foremost
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<h2 style="font-style: italic;">,,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"</h2>
|
||||||
|
<h3>-user 'autophage' on tumblr</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -15,6 +15,11 @@
|
|||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function sleep(ms) {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
|
||||||
|
var answid;
|
||||||
|
|
||||||
async function fetch_data()
|
async function fetch_data()
|
||||||
{
|
{
|
||||||
@@ -37,6 +42,51 @@
|
|||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function open_message(id)
|
||||||
|
{
|
||||||
|
answid = id;
|
||||||
|
var url = 'admin/api/all_messages/' + id;
|
||||||
|
|
||||||
|
fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Network response was not ok');
|
||||||
|
}
|
||||||
|
return response.text();
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
|
||||||
|
document.getElementById("messages").innerHTML = data + '<footer> <div class="textbox"><input class="text_input" name="valami" type="text" id="promptText" placeholder="answ"><button class="send_button" onclick="send_data()">send</button></div></footer>';
|
||||||
|
|
||||||
|
console.log(data.body)
|
||||||
|
})
|
||||||
|
.catch(error => {x0
|
||||||
|
console.error('Error:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function send_data()
|
||||||
|
{
|
||||||
|
let text = document.getElementById("promptText").value;
|
||||||
|
|
||||||
|
let url = "/admin/api/write/" + answid
|
||||||
|
|
||||||
|
fetch(url, {
|
||||||
|
method: "PUT",
|
||||||
|
body: text,
|
||||||
|
headers: {
|
||||||
|
"Content-type": "application/json; charset=UTF-8"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById("promptText").value = "";
|
||||||
|
|
||||||
|
await sleep(10);
|
||||||
|
open_message(answid);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -9,9 +9,11 @@
|
|||||||
</head>
|
</head>
|
||||||
<body onload="javascript:init()">
|
<body onload="javascript:init()">
|
||||||
|
|
||||||
|
<div class="main-flexbox">
|
||||||
|
|
||||||
<header class="navbar">
|
<header class="navbar">
|
||||||
<a href="https://sc0tt.org/" style="float: left" target="_blank">Sc0tt főoldal</a>
|
<a href="https://sc0tt.org/" style="float: left" target="_blank">Sc0tt főoldal</a>
|
||||||
<a href="#" style="float: left">About</a>
|
<a href="/about" style="float: left">About</a>
|
||||||
|
|
||||||
<img src="resources/logo.png" alt=logo" style="float: right;">
|
<img src="resources/logo.png" alt=logo" style="float: right;">
|
||||||
|
|
||||||
@@ -36,6 +38,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let id;
|
let id;
|
||||||
|
|
||||||
@@ -122,7 +126,9 @@
|
|||||||
|
|
||||||
async function fetch_data(route, recursive = true)
|
async function fetch_data(route, recursive = true)
|
||||||
{
|
{
|
||||||
var url = '/api/' + route + '/' + id
|
var url = '/api/' + route + '/' + id;
|
||||||
|
|
||||||
|
//if (route == "messages") url += '/u';
|
||||||
|
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|||||||
@@ -2,28 +2,60 @@ body {
|
|||||||
background: #212121;
|
background: #212121;
|
||||||
color: white;
|
color: white;
|
||||||
font-family: Roboto, sans-serif;
|
font-family: Roboto, sans-serif;
|
||||||
|
margin: 0; height: 100%; overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.about-content {
|
||||||
|
margin: auto;
|
||||||
|
width: 70%;
|
||||||
|
text-align: center;
|
||||||
|
border: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.about-content h1 {
|
||||||
|
font-size: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-content {
|
.main-content {
|
||||||
|
/*
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
justify-content: center;
|
justify-content: center;*/
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
height: 93vh;
|
||||||
|
overflow-y: scroll;
|
||||||
|
flex-grow: 8
|
||||||
|
|
||||||
|
background: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-user {
|
.main-flexbox {
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
padding: 0px 25px;
|
padding: 0px 25px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
width: 60%;
|
width: 60%;
|
||||||
color: white;
|
color: white;
|
||||||
background: black;
|
|
||||||
border-radius: 25px;
|
border-radius: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.message-user {
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-scott {
|
||||||
|
background: grey;
|
||||||
|
}
|
||||||
|
|
||||||
.messages {
|
.messages {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 10px auto 0px auto;
|
margin: 10px auto 0px auto;
|
||||||
@@ -87,26 +119,42 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.conversation p {
|
.conversation p {
|
||||||
background: black;
|
background: #151515;
|
||||||
margin: auto 10px;
|
margin: auto 10px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.conversation button {
|
||||||
|
border-radius: 15px;
|
||||||
|
background: #151515;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.conversation button:hover {
|
||||||
|
background: #252525;
|
||||||
|
}
|
||||||
|
|
||||||
.navbar {
|
.navbar {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background: #212121;
|
background: #212121;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
||||||
|
flex-grow: 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background: #212121;
|
background: #212121;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
||||||
|
background: green;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar a {
|
.navbar a {
|
||||||
|
|||||||
Reference in New Issue
Block a user