Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.20 #24

Merged
merged 7 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ Maven:
<dependency>
<groupId>com.simiacryptus</groupId>
<artifactId>skyenet-webui</artifactId>
<version>1.0.19</version>
<version>1.0.20</version>
</dependency>
```

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
Expand Down
4 changes: 2 additions & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion groovy/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions scala/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion util/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
6 changes: 3 additions & 3 deletions webui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class ChatSession(
override fun run(userMessage: String) {
var responseContents = divInitializer()
responseContents += """<div>$userMessage</div>"""
send("""$responseContents<div>${parent.spinner}</div>""")
send("""$responseContents<div>${SkyenetSessionServerBase.spinner}</div>""")
val response = handleMessage(userMessage, responseContents)
if(null != response) {
responseContents += """<div>${renderResponse(response)}</div>"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ abstract class SessionBase(val sessionId: String) : SessionInterface {
val spinner1 = if (showSpinner) """<div>$spinner</div>""" else ""
return [email protected]("""$responseContents$spinner1""")
}

override fun sessionID(): String {
return sessionId
}

override fun divID(): String {
return operationID
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ open class SkyenetCodingSession(
status.status = OperationStatus.OperationState.Cancelled
break
}
send("""$messageTrail<div>${parent.spinner}</div>""")
send("""$messageTrail<div>${SkyenetSessionServerBase.spinner}</div>""")
status.status = OperationStatus.OperationState.Running
parent.sessionDataStorage.updateOperationStatus(sessionId, status.operationID, status)
messageTrail += execute(messageTrail, status, codedInstruction)
Expand Down Expand Up @@ -156,7 +156,7 @@ open class SkyenetCodingSession(
//language=HTML
val buffer = StringBuffer()
buffer.append("""<div><h3>Code:</h3>""")
send("""$messageTrail$buffer${parent.spinner}</div>""")
send("""$messageTrail$buffer${SkyenetSessionServerBase.spinner}</div>""")
val response = brain.implement(describedInstruction)
val codeBlocks = Brain.extractCodeBlocks(response)
var renderedResponse = SessionServerUtil.getRenderedResponse(codeBlocks)
Expand All @@ -174,7 +174,7 @@ open class SkyenetCodingSession(
break
} catch (ex: Throwable) {
buffer.append("""<pre><code class="language-$language">${codedInstruction}</code></pre><pre>${ex.message}</pre>""")
send("""$messageTrail$buffer${parent.spinner}</div>""")
send("""$messageTrail$buffer${SkyenetSessionServerBase.spinner}</div>""")
val respondWithCode =
brain.fixCommand(describedInstruction, codedInstruction, ex, status.resultOutput)
renderedResponse = SessionServerUtil.getRenderedResponse(respondWithCode.second)
Expand All @@ -199,7 +199,7 @@ open class SkyenetCodingSession(
status: OperationStatus,
): Pair<String, String> {
//language=HTML
send("""$messageTrail<div><h3>New Code:</h3>${parent.spinner}</div>""")
send("""$messageTrail<div><h3>New Code:</h3>${SkyenetSessionServerBase.spinner}</div>""")
val respondWithCode =
brain.fixCommand(describedInstruction, codedInstruction, e, status.resultOutput)
val renderedResponse = SessionServerUtil.getRenderedResponse(respondWithCode.second)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() = """<div>${this@SkyenetMacroChat.spinner}</div>"""
override val spinner: String get() = """<div>${SkyenetSessionServerBase.spinner}</div>"""
override val playButton: String get() = """<button class="play-button" data-id="$operationID">▶</button>"""
override val cancelButton: String get() = """<button class="cancel-button" data-id="$operationID">&times;</button>"""
override val regenButton: String get() = """<button class="regen-button" data-id="$operationID">♲</button>"""
Expand Down Expand Up @@ -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
}

Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ abstract class SkyenetSessionServerBase(

abstract val api: OpenAIClient

open val spinner =
"""<div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div>"""

open val sessionDataStorage = SessionDataStorage(File(File(".skynet"), applicationName))

override fun configure(context: WebAppContext, prefix: String, baseURL: String) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -189,6 +190,8 @@ abstract class SkyenetSessionServerBase(

companion object {
val logger = org.slf4j.LoggerFactory.getLogger(SkyenetSessionServerBase::class.java)
val spinner =
"""<div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div>"""
}

}
Expand Down
Loading