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.2.19 #107

Merged
merged 1 commit into from
Nov 14, 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: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

## [Unreleased]

## [1.2.19]

### Fixed

- Code Chat

## [1.2.18]

### Improved
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repositories {
val kotlin_version = "1.9.20"
val jetty_version = "11.0.18"
val slf4j_version = "2.0.9"
val skyenet_version = "1.0.27"
val skyenet_version = "1.0.28"
dependencies {

implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.28")
Expand Down
12 changes: 12 additions & 0 deletions counters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"20231113-5ea3aa8c" : {
"tokensPerModel" : {
"GPT35Turbo" : 452
}
},
"20231113-83f5627c" : {
"tokensPerModel" : {
"GPT35Turbo" : 454
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pluginName=intellij-aicoder
pluginRepositoryUrl=https://github.com/SimiaCryptus/intellij-aicoder
# SemVer format -> https://semver.org
pluginVersion=1.2.18
pluginVersion=1.2.19
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
#pluginSinceBuild = 203
pluginSinceBuild=231
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.github.simiacryptus.aicoder.config.AppSettingsState
import com.github.simiacryptus.aicoder.util.UITools
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.project.Project
import com.simiacryptus.skyenet.sessions.WebSocketServer
import com.simiacryptus.skyenet.chat.ChatServer
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.server.handler.ContextHandlerCollection
import org.eclipse.jetty.webapp.WebAppContext
Expand All @@ -29,7 +29,7 @@ class AppServer(
}

@Synchronized
fun addApp(path: String, socketServer: WebSocketServer) {
fun addApp(path: String, socketServer: ChatServer) {
try {
synchronized(serverLock) {
if (server.isRunning) server.stop() // Stop the server
Expand All @@ -43,15 +43,14 @@ class AppServer(
}
}

private fun newWebAppContext(server: WebSocketServer, path: String): WebAppContext {
private fun newWebAppContext(server: ChatServer, path: String): WebAppContext {
val context = WebAppContext()
JettyWebSocketServletContainerInitializer.configure(context, null)
context.baseResource = server.baseResource
context.contextPath = path
context.welcomeFiles = arrayOf("index.html")
val webAppContext = context
server.configure(webAppContext, baseUrl = "$domainName/$path")
return webAppContext
server.configure(context, baseUrl = "$domainName/$path")
return context
}

private val handlers = arrayOf<WebAppContext>().toMutableList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CodeChatAction : BaseAction() {

override fun isEnabled(event: AnActionEvent): Boolean {
if (UITools.isSanctioned()) return false
return AppSettingsState.instance.devActions
return true
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,30 @@ package com.github.simiacryptus.aicoder.actions.dev
import com.github.simiacryptus.aicoder.config.AppSettingsState
import com.intellij.openapi.project.Project
import com.simiacryptus.openai.OpenAIClient
import com.simiacryptus.skyenet.sessions.*
import com.simiacryptus.skyenet.chat.ChatServer
import com.simiacryptus.skyenet.chat.ChatSession
import com.simiacryptus.skyenet.util.ClasspathResource
import com.simiacryptus.util.JsonUtil
import jakarta.servlet.http.HttpServlet
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import org.eclipse.jetty.servlet.ServletHolder
import org.eclipse.jetty.util.resource.Resource
import org.eclipse.jetty.webapp.WebAppContext

class CodeChatServer(
val project: Project,
val language: String,
val codeSelection: String,
val api: OpenAIClient,
resourceBase: String = "codeChat",
) : ChatApplicationBase(
applicationName = "Code Chat",
) : ChatServer(
resourceBase = resourceBase,
) {
override val applicationName: String
get() = "Code Chat"

override fun newSession(sessionId: String) = ChatSession(
override fun newSession(sessionId: String) = object : ChatSession(
sessionId = sessionId,
parent = this@CodeChatServer,
model = AppSettingsState.instance.defaultChatModel(),
Expand All @@ -40,16 +48,8 @@ class CodeChatServer(
|
|Responses may use markdown formatting.
""".trimMargin(),
)

override fun processMessage(
sessionId: String,
userMessage: String,
session: PersistentSessionBase,
sessionDiv: SessionDiv,
socket: MessageWebSocket
) {
TODO("Not yet implemented")
override fun canWrite(user: String?): Boolean = true
}

private fun htmlEscape(html: String): String {
Expand All @@ -61,4 +61,8 @@ class CodeChatServer(
override val baseResource: Resource
get() = ClasspathResource(javaClass.classLoader.getResource(resourceBase)!!)

override fun configure(webAppContext: WebAppContext, path: String, baseUrl: String) {
webAppContext.addServlet(ServletHolder(javaClass.simpleName + "/appInfo", AppInfoServlet()), "/appInfo")
super.configure(webAppContext, path, baseUrl)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import java.util.function.Supplier
import java.util.stream.Collectors
import javax.swing.*
import javax.swing.text.JTextComponent
import kotlin.math.max
import kotlin.reflect.KMutableProperty
import kotlin.reflect.KProperty1
import kotlin.reflect.KVisibility
Expand Down Expand Up @@ -201,7 +202,7 @@ object UITools {
val lineNumber = document.getLineNumber(caret.selectionStart)
val lines = documentText.split("\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
if (lines.isEmpty()) return ""
return IndentedText.fromString(lines[Math.max(lineNumber, 0).coerceAtMost(lines.size - 1)]).indent
return IndentedText.fromString(lines[max(lineNumber, 0).coerceAtMost(lines.size - 1)]).indent
}

@JvmStatic
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/permissions/admin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
1 change: 1 addition & 0 deletions src/main/resources/permissions/execute.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
1 change: 1 addition & 0 deletions src/main/resources/permissions/globalkey.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
1 change: 1 addition & 0 deletions src/main/resources/permissions/read.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
1 change: 1 addition & 0 deletions src/main/resources/permissions/write.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
2 changes: 2 additions & 0 deletions usage_log.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
20231113-5ea3aa8c,null,gpt-3.5-turbo-16k,452
20231113-83f5627c,null,gpt-3.5-turbo-16k,454
Loading