From 9abb6bb0308721b3cd58729568df5fdcc3c47862 Mon Sep 17 00:00:00 2001 From: Andrew Charneski <acharneski@gmail.com> Date: Thu, 23 May 2024 22:24:00 -0400 Subject: [PATCH] wip --- build.gradle.kts | 4 ++-- .../aicoder/actions/dev/LineFilterChatAction.kt | 4 +--- .../aicoder/actions/generic/CodeChatAction.kt | 4 +--- .../aicoder/actions/generic/DiffChatAction.kt | 4 +--- .../aicoder/actions/generic/GenericChatAction.kt | 8 +------- .../aicoder/actions/generic/MultiStepPatchAction.kt | 2 +- 6 files changed, 7 insertions(+), 19 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index ea9f6bf6..ed99e2ac 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,7 @@ repositories { val kotlin_version = "2.0.0-Beta5" val jetty_version = "11.0.18" val slf4j_version = "2.0.9" -val skyenet_version = "1.0.72" +val skyenet_version = "1.0.73" val remoterobot_version = "0.11.21" val jackson_version = "2.17.0" @@ -40,7 +40,7 @@ dependencies { exclude(group = "org.jetbrains.kotlin", module = "") } - implementation(group = "com.simiacryptus", name = "jo-penai", version = "1.0.56") + implementation(group = "com.simiacryptus", name = "jo-penai", version = "1.0.57") { exclude(group = "org.jetbrains.kotlin", module = "") } diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/LineFilterChatAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/LineFilterChatAction.kt index b7c12b10..152fd823 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/LineFilterChatAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/LineFilterChatAction.kt @@ -21,7 +21,6 @@ import com.simiacryptus.skyenet.webui.session.SocketManager import com.simiacryptus.skyenet.webui.util.MarkdownUtil.renderMarkdown import org.slf4j.LoggerFactory import java.awt.Desktop -import java.io.File class LineFilterChatAction : BaseAction() { override fun getActionUpdateThread() = ActionUpdateThread.BGT @@ -74,7 +73,7 @@ class LineFilterChatAction : BaseAction() { """.trimMargin(), api = api, applicationClass = ApplicationServer::class.java, - storage = ApplicationServices.dataStorageFactory(root), + storage = ApplicationServices.dataStorageFactory(AppSettingsState.instance.pluginHome), ) { override fun canWrite(user: User?): Boolean = true override fun renderResponse(response: String, task: SessionTask): String { @@ -109,7 +108,6 @@ class LineFilterChatAction : BaseAction() { companion object { private val log = LoggerFactory.getLogger(LineFilterChatAction::class.java) private val agents = mutableMapOf<Session, SocketManager>() - val root: File get() = File(AppSettingsState.instance.pluginHome, "code_chat") private fun initApp(server: AppServer, path: String): ChatServer { server.appRegistry[path]?.let { return it } val socketServer = object : ApplicationServer( diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CodeChatAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CodeChatAction.kt index d5757a9f..ed78103e 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CodeChatAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CodeChatAction.kt @@ -19,7 +19,6 @@ import com.simiacryptus.skyenet.webui.chat.ChatServer import com.simiacryptus.skyenet.webui.session.SocketManager import org.slf4j.LoggerFactory import java.awt.Desktop -import java.io.File class CodeChatAction : BaseAction() { override fun getActionUpdateThread() = ActionUpdateThread.BGT @@ -39,7 +38,7 @@ class CodeChatAction : BaseAction() { filename = filename, api = api, model = AppSettingsState.instance.smartModel.chatModel(), - storage = ApplicationServices.dataStorageFactory(root) + storage = ApplicationServices.dataStorageFactory(AppSettingsState.instance.pluginHome) ) val server = AppServer.getServer(e.project) @@ -61,7 +60,6 @@ class CodeChatAction : BaseAction() { companion object { private val log = LoggerFactory.getLogger(CodeChatAction::class.java) private val agents = mutableMapOf<Session, SocketManager>() - val root: File get() = File(AppSettingsState.instance.pluginHome, "code_chat") private fun initApp(server: AppServer, path: String): ChatServer { server.appRegistry[path]?.let { return it } val socketServer = object : ApplicationServer( diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DiffChatAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DiffChatAction.kt index acbb3f2e..5bd6e1a3 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DiffChatAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DiffChatAction.kt @@ -26,7 +26,6 @@ import com.simiacryptus.skyenet.webui.util.MarkdownUtil.renderMarkdown import org.intellij.lang.annotations.Language import org.slf4j.LoggerFactory import java.awt.Desktop -import java.io.File class DiffChatAction : BaseAction() { override fun getActionUpdateThread() = ActionUpdateThread.BGT @@ -60,7 +59,7 @@ class DiffChatAction : BaseAction() { filename = filename, api = api, model = AppSettingsState.instance.smartModel.chatModel(), - storage = ApplicationServices.dataStorageFactory(root) + storage = ApplicationServices.dataStorageFactory(AppSettingsState.instance.pluginHome) ) { override val systemPrompt: String @Language("Markdown") @@ -143,7 +142,6 @@ class DiffChatAction : BaseAction() { companion object { private val log = LoggerFactory.getLogger(DiffChatAction::class.java) private val agents = mutableMapOf<Session, SocketManager>() - val root: File get() = File(AppSettingsState.instance.pluginHome, "code_chat") private fun initApp(server: AppServer, path: String): ChatServer { server.appRegistry[path]?.let { return it } val socketServer = object : ApplicationServer( diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenericChatAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenericChatAction.kt index 5297f8df..45be72cd 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenericChatAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenericChatAction.kt @@ -4,12 +4,8 @@ import com.github.simiacryptus.aicoder.AppServer import com.github.simiacryptus.aicoder.actions.BaseAction import com.github.simiacryptus.aicoder.config.AppSettingsState import com.github.simiacryptus.aicoder.config.AppSettingsState.Companion.chatModel -import com.github.simiacryptus.aicoder.util.CodeChatSocketManager -import com.github.simiacryptus.aicoder.util.ComputerLanguage import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.actionSystem.CommonDataKeys -import com.intellij.openapi.fileEditor.FileDocumentManager import com.simiacryptus.skyenet.core.platform.ApplicationServices import com.simiacryptus.skyenet.core.platform.Session import com.simiacryptus.skyenet.core.platform.StorageInterface @@ -20,7 +16,6 @@ import com.simiacryptus.skyenet.webui.chat.ChatSocketManager import com.simiacryptus.skyenet.webui.session.SocketManager import org.slf4j.LoggerFactory import java.awt.Desktop -import java.io.File class GenericChatAction : BaseAction() { override fun getActionUpdateThread() = ActionUpdateThread.BGT @@ -39,7 +34,7 @@ class GenericChatAction : BaseAction() { userInterfacePrompt = userInterfacePrompt, systemPrompt = systemPrompt, api = api, - storage = ApplicationServices.dataStorageFactory(root), + storage = ApplicationServices.dataStorageFactory(AppSettingsState.instance.pluginHome), applicationClass = ApplicationServer::class.java, ) @@ -62,7 +57,6 @@ class GenericChatAction : BaseAction() { companion object { private val log = LoggerFactory.getLogger(CodeChatAction::class.java) private val agents = mutableMapOf<Session, SocketManager>() - val root: File get() = File(AppSettingsState.instance.pluginHome, "code_chat") private fun initApp(server: AppServer, path: String): ChatServer { server.appRegistry[path]?.let { return it } val socketServer = object : ApplicationServer( diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiStepPatchAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiStepPatchAction.kt index 87154ff2..da397d87 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiStepPatchAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiStepPatchAction.kt @@ -42,7 +42,7 @@ class MultiStepPatchAction : BaseAction() { override fun handle(e: AnActionEvent) { val session = StorageInterface.newGlobalID() - val storage = ApplicationServices.dataStorageFactory(DiffChatAction.root) as DataStorage? + val storage = ApplicationServices.dataStorageFactory(AppSettingsState.instance.pluginHome) as DataStorage? val selectedFile = UITools.getSelectedFolder(e) if (null != storage && null != selectedFile) { DataStorage.sessionPaths[session] = selectedFile.toFile