From 40e3df719e634af137e3a4d0fe49456ebeb93e67 Mon Sep 17 00:00:00 2001 From: Andrew Charneski Date: Sat, 4 Nov 2023 19:21:48 -0400 Subject: [PATCH] 1.0.20 (#24) * 1.0.20 * 1.0.20 * 1.0.20 * 1.0.20 * 1.0.20 * Fuck me life, and fuck yours too * 1.0.20 --- README.md | 6 +++--- core/build.gradle.kts | 4 ++-- gradle.properties | 2 +- groovy/build.gradle.kts | 2 +- java/build.gradle.kts | 2 +- kotlin/build.gradle.kts | 2 +- scala/build.gradle.kts | 4 ++-- util/build.gradle.kts | 2 +- webui/build.gradle.kts | 6 +++--- .../com/simiacryptus/skyenet/body/ChatSession.kt | 2 +- .../com/simiacryptus/skyenet/body/SessionBase.kt | 8 ++++++++ .../simiacryptus/skyenet/body/SkyenetCodingSession.kt | 8 ++++---- .../com/simiacryptus/skyenet/body/SkyenetMacroChat.kt | 6 ++++-- .../skyenet/body/SkyenetSessionServerBase.kt | 11 +++++++---- 14 files changed, 39 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index bb31a703..df9f156d 100644 --- a/README.md +++ b/README.md @@ -76,18 +76,18 @@ Maven: com.simiacryptus skyenet-webui - 1.0.19 + 1.0.20 ``` Gradle: ```groovy -implementation group: 'com.simiacryptus', name: 'skyenet', version: '1.0.19' +implementation group: 'com.simiacryptus', name: 'skyenet', version: '1.0.20' ``` ```kotlin -implementation("com.simiacryptus:skyenet:1.0.19") +implementation("com.simiacryptus:skyenet:1.0.20") ``` ### 🌟 To Use diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 99fd29da..41ff14ff 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -30,9 +30,9 @@ val kotlin_version = "1.7.22" val junit_version = "5.9.2" dependencies { - implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.20") + implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.23") - implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.5") + implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.9") compileOnlyApi(kotlin("stdlib")) diff --git a/gradle.properties b/gradle.properties index 0a13cc83..7e5d6c12 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ # Gradle Releases -> https://github.com/gradle/gradle/releases libraryGroup = com.simiacryptus.skyenet -libraryVersion = 1.0.19 +libraryVersion = 1.0.20 gradleVersion = 7.6.1 # Opt-out flag for bundling Kotlin standard library -> https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library diff --git a/groovy/build.gradle.kts b/groovy/build.gradle.kts index bbb15a64..5a9291c8 100644 --- a/groovy/build.gradle.kts +++ b/groovy/build.gradle.kts @@ -36,7 +36,7 @@ dependencies { implementation(group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.7.1") implementation(group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version = kotlin_version) - implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.5") + implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.9") implementation(group = "commons-io", name = "commons-io", version = "2.11.0") testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = "5.9.2") diff --git a/java/build.gradle.kts b/java/build.gradle.kts index 5bd14b67..579f2ede 100644 --- a/java/build.gradle.kts +++ b/java/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { implementation(kotlin("stdlib-jdk8")) implementation(group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version = kotlin_version) - implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.5") + implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.9") implementation(group = "commons-io", name = "commons-io", version = "2.11.0") testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = "5.9.2") diff --git a/kotlin/build.gradle.kts b/kotlin/build.gradle.kts index 2f60cd9a..da338e05 100644 --- a/kotlin/build.gradle.kts +++ b/kotlin/build.gradle.kts @@ -38,7 +38,7 @@ dependencies { implementation(kotlin("compiler-embeddable")) implementation(kotlin("scripting-compiler-embeddable")) - implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.5") + implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.9") implementation(group = "commons-io", name = "commons-io", version = "2.11.0") testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = "5.9.2") diff --git a/scala/build.gradle.kts b/scala/build.gradle.kts index 74c5c1dc..4d23e6d5 100644 --- a/scala/build.gradle.kts +++ b/scala/build.gradle.kts @@ -36,9 +36,9 @@ dependencies { implementation(group = "org.scala-lang", name = "scala-library", version = scala_version) implementation(group = "org.scala-lang", name = "scala-compiler", version = scala_version) implementation(group = "org.scala-lang", name = "scala-reflect", version = scala_version) - implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.5") + implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.9") - testImplementation(group = "org.slf4j", name = "slf4j-simple", version = "2.0.5") + testImplementation(group = "org.slf4j", name = "slf4j-simple", version = "2.0.9") testImplementation(group = "org.junit.jupiter", name = "junit-jupiter", version = "5.8.1") testImplementation(group = "org.scala-lang.modules", name = "scala-java8-compat_2.13", version = "0.9.1") diff --git a/util/build.gradle.kts b/util/build.gradle.kts index 2c9f1227..2466eab9 100644 --- a/util/build.gradle.kts +++ b/util/build.gradle.kts @@ -33,7 +33,7 @@ val logback_version = "1.2.12" dependencies { - implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.20") + implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.23") implementation(project(":core")) implementation(project(":webui")) diff --git a/webui/build.gradle.kts b/webui/build.gradle.kts index 7853ba65..b350096b 100644 --- a/webui/build.gradle.kts +++ b/webui/build.gradle.kts @@ -32,7 +32,7 @@ val jetty_version = "11.0.17" val jackson_version = "2.15.2" dependencies { - implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.20") + implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.23") implementation(project(":core")) testImplementation(project(":groovy")) @@ -63,8 +63,8 @@ dependencies { implementation(group = "commons-io", name = "commons-io", version = "2.11.0") implementation(group = "commons-codec", name = "commons-codec", version = "1.16.0") - implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.5") - testImplementation(group = "org.slf4j", name = "slf4j-simple", version = "2.0.5") + implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.9") + testImplementation(group = "org.slf4j", name = "slf4j-simple", version = "2.0.9") testImplementation(kotlin("script-runtime")) testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = "5.9.2") diff --git a/webui/src/main/kotlin/com/simiacryptus/skyenet/body/ChatSession.kt b/webui/src/main/kotlin/com/simiacryptus/skyenet/body/ChatSession.kt index 7d3ae788..59127a84 100644 --- a/webui/src/main/kotlin/com/simiacryptus/skyenet/body/ChatSession.kt +++ b/webui/src/main/kotlin/com/simiacryptus/skyenet/body/ChatSession.kt @@ -24,7 +24,7 @@ abstract class ChatSession( override fun run(userMessage: String) { var responseContents = divInitializer() responseContents += """
$userMessage
""" - send("""$responseContents
${parent.spinner}
""") + send("""$responseContents
${SkyenetSessionServerBase.spinner}
""") val response = handleMessage(userMessage, responseContents) if(null != response) { responseContents += """
${renderResponse(response)}
""" diff --git a/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SessionBase.kt b/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SessionBase.kt index d7a8872f..d98548f0 100644 --- a/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SessionBase.kt +++ b/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SessionBase.kt @@ -46,6 +46,14 @@ abstract class SessionBase(val sessionId: String) : SessionInterface { val spinner1 = if (showSpinner) """
$spinner
""" else "" return this@SessionBase.send("""$responseContents$spinner1""") } + + override fun sessionID(): String { + return sessionId + } + + override fun divID(): String { + return operationID + } } } } \ No newline at end of file diff --git a/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetCodingSession.kt b/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetCodingSession.kt index 779167cd..8ae6c926 100644 --- a/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetCodingSession.kt +++ b/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetCodingSession.kt @@ -92,7 +92,7 @@ open class SkyenetCodingSession( status.status = OperationStatus.OperationState.Cancelled break } - send("""$messageTrail
${parent.spinner}
""") + send("""$messageTrail
${SkyenetSessionServerBase.spinner}
""") status.status = OperationStatus.OperationState.Running parent.sessionDataStorage.updateOperationStatus(sessionId, status.operationID, status) messageTrail += execute(messageTrail, status, codedInstruction) @@ -156,7 +156,7 @@ open class SkyenetCodingSession( //language=HTML val buffer = StringBuffer() buffer.append("""

Code:

""") - send("""$messageTrail$buffer${parent.spinner}
""") + send("""$messageTrail$buffer${SkyenetSessionServerBase.spinner}""") val response = brain.implement(describedInstruction) val codeBlocks = Brain.extractCodeBlocks(response) var renderedResponse = SessionServerUtil.getRenderedResponse(codeBlocks) @@ -174,7 +174,7 @@ open class SkyenetCodingSession( break } catch (ex: Throwable) { buffer.append("""
${codedInstruction}
${ex.message}
""") - send("""$messageTrail$buffer${parent.spinner}""") + send("""$messageTrail$buffer${SkyenetSessionServerBase.spinner}""") val respondWithCode = brain.fixCommand(describedInstruction, codedInstruction, ex, status.resultOutput) renderedResponse = SessionServerUtil.getRenderedResponse(respondWithCode.second) @@ -199,7 +199,7 @@ open class SkyenetCodingSession( status: OperationStatus, ): Pair { //language=HTML - send("""$messageTrail

New Code:

${parent.spinner}
""") + send("""$messageTrail

New Code:

${SkyenetSessionServerBase.spinner}
""") val respondWithCode = brain.fixCommand(describedInstruction, codedInstruction, e, status.resultOutput) val renderedResponse = SessionServerUtil.getRenderedResponse(respondWithCode.second) diff --git a/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetMacroChat.kt b/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetMacroChat.kt index d0fd3636..df889d7e 100644 --- a/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetMacroChat.kt +++ b/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetMacroChat.kt @@ -41,12 +41,12 @@ abstract class SkyenetMacroChat( val session : PersistentSessionBase = this override fun run(userMessage: String) { val operationID = ChatSession.randomID() - val sessionDiv = newSessionDiv(operationID, spinner) + val sessionDiv = newSessionDiv(operationID, SkyenetSessionServerBase.spinner) val thread = Thread { playSempaphores[operationID] = Semaphore(0) try { processMessage(sessionId, userMessage, session, object : SessionUI { - override val spinner: String get() = """
${this@SkyenetMacroChat.spinner}
""" + override val spinner: String get() = """
${SkyenetSessionServerBase.spinner}
""" override val playButton: String get() = """""" override val cancelButton: String get() = """""" override val regenButton: String get() = """""" @@ -135,5 +135,7 @@ abstract class SkyenetMacroChat( abstract class SessionDiv { abstract fun append(htmlToAppend: String, showSpinner: Boolean) : Unit + abstract fun sessionID(): String + abstract fun divID(): String } diff --git a/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetSessionServerBase.kt b/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetSessionServerBase.kt index d75c5408..04c2c1bb 100644 --- a/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetSessionServerBase.kt +++ b/webui/src/main/kotlin/com/simiacryptus/skyenet/body/SkyenetSessionServerBase.kt @@ -21,9 +21,6 @@ abstract class SkyenetSessionServerBase( abstract val api: OpenAIClient - open val spinner = - """
Loading...
""" - open val sessionDataStorage = SessionDataStorage(File(File(".skynet"), applicationName)) override fun configure(context: WebAppContext, prefix: String, baseURL: String) { @@ -113,7 +110,11 @@ abstract class SkyenetSessionServerBase( "text/plain" } resp.status = HttpServletResponse.SC_OK - resp.writer.write(file.readText()) + file.inputStream().use { inputStream -> + resp.outputStream.use { outputStream -> + inputStream.copyTo(outputStream) + } + } } else { resp.contentType = "text/html" resp.status = HttpServletResponse.SC_OK @@ -189,6 +190,8 @@ abstract class SkyenetSessionServerBase( companion object { val logger = org.slf4j.LoggerFactory.getLogger(SkyenetSessionServerBase::class.java) + val spinner = + """
Loading...
""" } }