diff --git a/build.gradle.kts b/build.gradle.kts index cd73adab..95b2a5e8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,10 +25,10 @@ repositories { val kotlin_version = "1.9.20" val jetty_version = "11.0.18" val slf4j_version = "2.0.9" -val skyenet_version = "1.0.33" +val skyenet_version = "1.0.34" dependencies { - implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.31") + implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.32") implementation(group = "com.simiacryptus.skyenet", name = "core", version = skyenet_version) implementation(group = "com.simiacryptus.skyenet", name = "webui", version = skyenet_version) diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/BaseAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/BaseAction.kt index 6a42a82d..9d8eef97 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/BaseAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/BaseAction.kt @@ -14,7 +14,7 @@ abstract class BaseAction( icon: Icon? = null, ) : AnAction(name, description, icon) { - val log by lazy { LoggerFactory.getLogger(javaClass) } + private val log by lazy { LoggerFactory.getLogger(javaClass) } //override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT val api: OpenAIClient diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/FileContextAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/FileContextAction.kt index 6e55cd88..942c3dd9 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/FileContextAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/FileContextAction.kt @@ -7,6 +7,7 @@ import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.openapi.vfs.VirtualFile +import org.slf4j.LoggerFactory import java.io.File abstract class FileContextAction( @@ -76,4 +77,8 @@ abstract class FileContextAction( return if (virtualFile.isDirectory) supportsFolders else supportsFiles } + companion object { + private val log = LoggerFactory.getLogger(FileContextAction::class.java) + } + } \ No newline at end of file diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/AppServer.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/AppServer.kt index 99339baa..4daeafbc 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/AppServer.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/AppServer.kt @@ -18,7 +18,7 @@ class AppServer( project: Project? ) { - val log by lazy { LoggerFactory.getLogger(javaClass) } + private val log by lazy { LoggerFactory.getLogger(javaClass) } private var domainName: String = "http://$localName:$port" diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/CodeChatAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/CodeChatAction.kt index a57b5599..b5769c9b 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/CodeChatAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/CodeChatAction.kt @@ -8,6 +8,7 @@ import com.github.simiacryptus.aicoder.util.ComputerLanguage import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys +import org.slf4j.LoggerFactory import java.awt.Desktop import java.util.* @@ -36,4 +37,7 @@ class CodeChatAction : BaseAction() { return !UITools.isSanctioned() } + companion object { + private val log = LoggerFactory.getLogger(CodeChatAction::class.java) + } } diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/ConvertFileTo.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/ConvertFileTo.kt index ac41b1d4..17cfaf42 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/ConvertFileTo.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/ConvertFileTo.kt @@ -12,6 +12,7 @@ import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile +import org.slf4j.LoggerFactory import java.io.IOException import java.util.concurrent.atomic.AtomicReference @@ -50,31 +51,6 @@ class ConvertFileTo : ActionGroup() { return actions.toArray(arrayOf()) } - companion object { - - fun getNewFile(project: Project?, file: VirtualFile, language: ComputerLanguage): VirtualFile { - val newFileRef = AtomicReference() - WriteCommandAction.runWriteCommandAction(project) { - try { - val newFileName = file.nameWithoutExtension + "." + language.extensions[0] - newFileRef.set(file.parent.createChildData(file, newFileName)) - } catch (ex: IOException) { - throw RuntimeException(ex) - } - } - return newFileRef.get() - } - - fun write(project: Project?, newFile: VirtualFile, content: String) { - WriteCommandAction.runWriteCommandAction(project) { - try { - newFile.setBinaryContent(content.toByteArray()) - } catch (e: IOException) { - throw RuntimeException(e) - } - } - } - } class ConvertFileToLanguage(private val targetLanguage: ComputerLanguage) : BaseAction( targetLanguage.name @@ -103,4 +79,32 @@ class ConvertFileTo : ActionGroup() { } } + + companion object { + + fun getNewFile(project: Project?, file: VirtualFile, language: ComputerLanguage): VirtualFile { + val newFileRef = AtomicReference() + WriteCommandAction.runWriteCommandAction(project) { + try { + val newFileName = file.nameWithoutExtension + "." + language.extensions[0] + newFileRef.set(file.parent.createChildData(file, newFileName)) + } catch (ex: IOException) { + throw RuntimeException(ex) + } + } + return newFileRef.get() + } + + fun write(project: Project?, newFile: VirtualFile, content: String) { + WriteCommandAction.runWriteCommandAction(project) { + try { + newFile.setBinaryContent(content.toByteArray()) + } catch (e: IOException) { + throw RuntimeException(e) + } + } + } + + private val log = LoggerFactory.getLogger(ConvertFileTo::class.java) + } } diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/PrintTreeAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/PrintTreeAction.kt index e9b42bc4..010784d3 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/PrintTreeAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/PrintTreeAction.kt @@ -5,7 +5,7 @@ import com.github.simiacryptus.aicoder.config.AppSettingsState import com.github.simiacryptus.aicoder.util.UITools import com.github.simiacryptus.aicoder.util.psi.PsiUtil import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.diagnostic.Logger +import org.slf4j.LoggerFactory /** * The PrintTreeAction class is an IntelliJ action that enables developers to print the tree structure of a PsiFile. @@ -27,6 +27,6 @@ class PrintTreeAction : BaseAction() { } companion object { - val log = Logger.getInstance(PrintTreeAction::class.java) + private val log = LoggerFactory.getLogger(PrintTreeAction::class.java) } } diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DictationAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DictationAction.kt index d083d1aa..14b3022f 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DictationAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DictationAction.kt @@ -6,9 +6,9 @@ import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.actionSystem.PlatformDataKeys import com.intellij.openapi.command.WriteCommandAction -import com.intellij.openapi.diagnostic.Logger import com.simiacryptus.util.audio.AudioRecorder import com.simiacryptus.util.audio.LookbackLoudnessWindowBuffer +import org.slf4j.LoggerFactory import java.util.* import java.util.concurrent.ConcurrentLinkedDeque import java.util.concurrent.Executors @@ -122,7 +122,7 @@ class DictationAction : BaseAction() { } companion object { - val log = Logger.getInstance(DictationAction::class.java) + private val log = LoggerFactory.getLogger(DictationAction::class.java) private val pool = Executors.newFixedThreadPool(1) diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/ActionSettingsRegistry.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/config/ActionSettingsRegistry.kt index 83d8b8f2..730fcc29 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/ActionSettingsRegistry.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/config/ActionSettingsRegistry.kt @@ -176,7 +176,7 @@ class ActionSettingsRegistry { companion object { - val log = org.slf4j.LoggerFactory.getLogger(ActionSettingsRegistry::class.java) + private val log = org.slf4j.LoggerFactory.getLogger(ActionSettingsRegistry::class.java) val actionCache = HashMap() private fun load(actionPackage: String, actionName: String, language: String) = diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/ActionTable.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/config/ActionTable.kt index 3e297204..76f8d6d6 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/ActionTable.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/config/ActionTable.kt @@ -1,7 +1,6 @@ package com.github.simiacryptus.aicoder.config import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.project.Project import com.intellij.openapi.ui.VerticalFlowLayout @@ -12,6 +11,7 @@ import com.intellij.ui.components.JBScrollPane import com.intellij.ui.components.panels.HorizontalLayout import com.intellij.ui.table.JBTable import org.jdesktop.swingx.JXTable +import org.slf4j.LoggerFactory import java.awt.BorderLayout import java.awt.event.ActionEvent import java.util.* @@ -44,9 +44,6 @@ class ActionTable( } } - companion object { - private val log = Logger.getInstance(ActionTable::class.java) - } private val buttonPanel = JPanel() val columnNames = arrayOf("Enabled", "Display Text", "ID") @@ -218,4 +215,7 @@ class ActionTable( buttonPanel.add(removeButton) add(buttonPanel, BorderLayout.SOUTH) } + companion object { + private val log = LoggerFactory.getLogger(ActionTable::class.java) + } } diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt index a426744d..e0012993 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt @@ -3,7 +3,6 @@ package com.github.simiacryptus.aicoder.config import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.project.Project import com.intellij.openapi.ui.ComboBox @@ -13,6 +12,7 @@ import com.intellij.ui.components.JBPasswordField import com.intellij.ui.components.JBTextField import com.simiacryptus.openai.models.ChatModels import com.simiacryptus.openai.OpenAIClientBase +import org.slf4j.LoggerFactory import java.awt.event.ActionEvent import javax.swing.AbstractAction import javax.swing.JButton @@ -117,9 +117,7 @@ class AppSettingsComponent { } companion object { - private val log = Logger.getInstance( - AppSettingsComponent::class.java - ) + private val log = LoggerFactory.getLogger(AppSettingsComponent::class.java) //val ACTIONS_TOPIC = Topic.create("Actions", ActionChangedListener::class.java) } } diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/ModelSelectionWidgetFactory.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/ui/ModelSelectionWidgetFactory.kt index 6c58fbc4..ed8ed453 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/ModelSelectionWidgetFactory.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/ui/ModelSelectionWidgetFactory.kt @@ -18,7 +18,7 @@ import javax.swing.ListModel class ModelSelectionWidgetFactory : StatusBarWidgetFactory { companion object { - val log = org.slf4j.LoggerFactory.getLogger(ModelSelectionWidgetFactory::class.java) + private val log = org.slf4j.LoggerFactory.getLogger(ModelSelectionWidgetFactory::class.java) } class ModelSelectionWidget : StatusBarWidget, StatusBarWidget.MultipleTextValuesPresentation { diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TemperatureControlWidgetFactory.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TemperatureControlWidgetFactory.kt index 4c3df59c..9c03b905 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TemperatureControlWidgetFactory.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TemperatureControlWidgetFactory.kt @@ -28,7 +28,7 @@ import javax.swing.event.ChangeListener class TemperatureControlWidgetFactory : StatusBarWidgetFactory { companion object { - val log = org.slf4j.LoggerFactory.getLogger(TemperatureControlWidgetFactory::class.java) + private val log = org.slf4j.LoggerFactory.getLogger(TemperatureControlWidgetFactory::class.java) val pool = Executors.newCachedThreadPool() } diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt index dc251085..223ac9e8 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt @@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicBoolean class TokenCountWidgetFactory : StatusBarWidgetFactory { companion object { - val log = org.slf4j.LoggerFactory.getLogger(TokenCountWidgetFactory::class.java) + private val log = org.slf4j.LoggerFactory.getLogger(TokenCountWidgetFactory::class.java) val workQueue = LinkedBlockingDeque() val pool = ThreadPoolExecutor( /* corePoolSize = */ 1, /* maximumPoolSize = */ 1, diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaOpenAIClient.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaOpenAIClient.kt index b0948a19..920277de 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaOpenAIClient.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaOpenAIClient.kt @@ -1,5 +1,6 @@ package com.github.simiacryptus.aicoder.util +import com.github.simiacryptus.aicoder.config.ActionTable import com.github.simiacryptus.aicoder.config.AppSettingsState import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager @@ -12,6 +13,7 @@ import com.simiacryptus.openai.OpenAIClient import com.simiacryptus.openai.models.OpenAITextModel import com.simiacryptus.util.JsonUtil import org.apache.hc.core5.http.HttpRequest +import org.slf4j.LoggerFactory import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicReference import javax.swing.JPanel @@ -187,5 +189,8 @@ class IdeaOpenAIClient : OpenAIClient( val project = lastEvent?.project ?: return function(request) return function(JsonUtil.fromJson(uiEdit(project, title, JsonUtil.toJson(request)), request::class.java)) } + + private val log = LoggerFactory.getLogger(IdeaOpenAIClient::class.java) } + } diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiTranslationTree.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiTranslationTree.kt index 92353cf1..99d5da98 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiTranslationTree.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiTranslationTree.kt @@ -5,12 +5,12 @@ import com.github.simiacryptus.aicoder.util.ComputerLanguage import com.github.simiacryptus.aicoder.util.IdeaOpenAIClient import com.github.simiacryptus.aicoder.util.UITools.filterStringResult import com.intellij.openapi.application.runReadAction -import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement import com.intellij.psi.PsiElementVisitor import com.intellij.psi.PsiFile import com.simiacryptus.openai.proxy.ChatProxy +import org.slf4j.LoggerFactory import java.util.* import java.util.concurrent.ExecutionException import java.util.concurrent.TimeoutException @@ -223,7 +223,7 @@ class PsiTranslationTree( companion object { - val log = Logger.getInstance(PsiTranslationTree::class.java) + private val log = LoggerFactory.getLogger(PsiTranslationTree::class.java) fun parseFile( psiFile: PsiFile,