Skip to content

Commit

Permalink
1.0.25 (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski authored Nov 12, 2023
1 parent 6c66815 commit 2737676
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 12 deletions.
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.24</version>
<version>1.0.25</version>
</dependency>
```

Gradle:

```groovy
implementation group: 'com.simiacryptus', name: 'skyenet', version: '1.0.24'
implementation group: 'com.simiacryptus', name: 'skyenet', version: '1.0.25'
```

```kotlin
implementation("com.simiacryptus:skyenet:1.0.24")
implementation("com.simiacryptus:skyenet:1.0.25")
```

### 🌟 To Use
Expand Down
2 changes: 1 addition & 1 deletion core/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.26")
implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.27")

implementation(group = "org.slf4j", name = "slf4j-api", version = "2.0.9")
implementation(group = "commons-io", name = "commons-io", version = "2.11.0")
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.24
libraryVersion = 1.0.25
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 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.26")
implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.27")

implementation(project(":core"))
testImplementation(project(":groovy"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.simiacryptus.skyenet.servers

import com.simiacryptus.skyenet.sessions.*
import org.slf4j.LoggerFactory
import java.io.File

open class ReadOnlyApp(
applicationName: String,
Expand All @@ -18,8 +19,22 @@ open class ReadOnlyApp(
val log = LoggerFactory.getLogger(ReadOnlyApp::class.java)
}

override fun newSession(sessionId: String): SessionInterface {
throw UnsupportedOperationException()
override fun newSession(sessionId: String): SessionInterface = object : SessionInterface {
override fun removeSocket(socket: MessageWebSocket) {
// Do nothing
}

override fun addSocket(socket: MessageWebSocket) {
// Do nothing
}

override fun getReplay(): List<String> {
return SessionDataStorage(File(File(".skynet"), applicationName)).loadMessages(sessionId).values.toList()
}

override fun onWebSocketText(socket: MessageWebSocket, message: String) {
// Do nothing
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MessageWebSocket(
)
) {
override fun incrementTokens(model: Model?, tokens: Int) {
incrementUsage(sessionId, userinfo, model!!, tokens)
if(null != model) incrementUsage(sessionId, userinfo, model, tokens)
super.incrementTokens(model, tokens)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ abstract class WebSocketServer(val resourceBase: String) {
return@setCreator if (null == sessionId) {
null
} else {
MessageWebSocket(sessionId, stateCache.getOrPut(sessionId) {
newSession(sessionId)
}, authId, sessionDataStorage)
val sessionState: SessionInterface
if (stateCache.containsKey(sessionId)) {
sessionState = stateCache[sessionId]!!
} else {
sessionState = newSession(sessionId)
if(null != sessionState) stateCache[sessionId] = sessionState
}
MessageWebSocket(sessionId, sessionState, authId, sessionDataStorage)
}
}
}
Expand Down

0 comments on commit 2737676

Please sign in to comment.