diff --git a/build.gradle.kts b/build.gradle.kts index 13bffe27..f2b609f3 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.35" +val skyenet_version = "1.0.37" dependencies { - implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.32") + implementation(group = "com.simiacryptus", name = "jo-penai", version = "1.0.34") implementation(group = "com.simiacryptus.skyenet", name = "core", version = skyenet_version) implementation(group = "com.simiacryptus.skyenet", name = "webui", version = skyenet_version) diff --git a/gradle.properties b/gradle.properties index 99f06cb9..08f7012e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ pluginName=intellij-aicoder pluginRepositoryUrl=https://github.com/SimiaCryptus/intellij-aicoder # SemVer format -> https://semver.org -pluginVersion=1.2.22 +pluginVersion=1.2.23 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html #pluginSinceBuild = 203 pluginSinceBuild=231 diff --git a/settings.gradle.kts b/settings.gradle.kts index 2e0bd7c1..eadccabe 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,8 +4,8 @@ plugins { id("org.gradle.toolchains.foojay-resolver-convention") version ("0.4.0") } -//includeBuild("../joe-penai/") -//includeBuild("../SkyeNet/") +includeBuild("../jo-penai/") +includeBuild("../SkyeNet/") //includeBuild("../AwsAgent/") diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/CommentsAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/CommentsAction.groovy index 3177a8cd..9f80cc79 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/CommentsAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/CommentsAction.groovy @@ -4,7 +4,7 @@ import com.github.simiacryptus.aicoder.actions.SelectionAction import com.github.simiacryptus.aicoder.config.AppSettingsState import com.github.simiacryptus.aicoder.util.ComputerLanguage import com.intellij.openapi.project.Project -import com.simiacryptus.openai.proxy.ChatProxy +import com.simiacryptus.jopenai.proxy.ChatProxy import org.jetbrains.annotations.Nullable class CommentsAction extends SelectionAction { diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/CustomEditAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/CustomEditAction.groovy index ead12541..354ec208 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/CustomEditAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/CustomEditAction.groovy @@ -4,7 +4,7 @@ import com.github.simiacryptus.aicoder.actions.SelectionAction import com.github.simiacryptus.aicoder.config.AppSettingsState import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.project.Project -import com.simiacryptus.openai.proxy.ChatProxy +import com.simiacryptus.jopenai.proxy.ChatProxy import org.jetbrains.annotations.Nullable import javax.swing.* diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/DescribeAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/DescribeAction.groovy index b9f90186..b07fa10b 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/DescribeAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/DescribeAction.groovy @@ -5,8 +5,8 @@ import com.github.simiacryptus.aicoder.config.AppSettingsState import com.github.simiacryptus.aicoder.util.IndentedText import com.github.simiacryptus.aicoder.util.TextBlockFactory import com.intellij.openapi.project.Project -import com.simiacryptus.openai.proxy.ChatProxy -import com.simiacryptus.util.StringUtil +import com.simiacryptus.jopenai.proxy.ChatProxy +import com.simiacryptus.jopenai.util.StringUtil import org.jetbrains.annotations.Nullable class DescribeAction extends SelectionAction { diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/DocAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/DocAction.groovy index b446cfad..cfd7dbc3 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/DocAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/DocAction.groovy @@ -6,7 +6,7 @@ import com.github.simiacryptus.aicoder.util.ComputerLanguage import com.github.simiacryptus.aicoder.util.IndentedText import com.github.simiacryptus.aicoder.util.psi.PsiUtil import com.intellij.openapi.project.Project -import com.simiacryptus.openai.proxy.ChatProxy +import com.simiacryptus.jopenai.proxy.ChatProxy import kotlin.Pair import org.jetbrains.annotations.Nullable diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/ImplementStubAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/ImplementStubAction.groovy index 719de519..829355df 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/ImplementStubAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/ImplementStubAction.groovy @@ -5,8 +5,8 @@ import com.github.simiacryptus.aicoder.config.AppSettingsState import com.github.simiacryptus.aicoder.util.ComputerLanguage import com.github.simiacryptus.aicoder.util.psi.PsiUtil import com.intellij.openapi.project.Project -import com.simiacryptus.openai.proxy.ChatProxy -import com.simiacryptus.util.StringUtil +import com.simiacryptus.jopenai.proxy.ChatProxy +import com.simiacryptus.jopenai.util.StringUtil import kotlin.Pair import org.jetbrains.annotations.Nullable diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/InsertImplementationAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/InsertImplementationAction.groovy index c9eb50e5..77175013 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/InsertImplementationAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/InsertImplementationAction.groovy @@ -6,9 +6,8 @@ import com.github.simiacryptus.aicoder.util.ComputerLanguage import com.github.simiacryptus.aicoder.util.UITools import com.github.simiacryptus.aicoder.util.psi.PsiClassContext import com.github.simiacryptus.aicoder.util.psi.PsiUtil -import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.Project -import com.simiacryptus.openai.proxy.ChatProxy +import com.simiacryptus.jopenai.proxy.ChatProxy import kotlin.Pair import org.jetbrains.annotations.NotNull import org.jetbrains.annotations.Nullable diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/PasteAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/PasteAction.groovy index c1dbcc6d..564b5f54 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/PasteAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/PasteAction.groovy @@ -3,13 +3,12 @@ package com.github.simiacryptus.aicoder.actions.code import com.github.simiacryptus.aicoder.actions.SelectionAction import com.github.simiacryptus.aicoder.config.AppSettingsState import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.project.Project -import com.simiacryptus.openai.proxy.ChatProxy +import com.simiacryptus.jopenai.proxy.ChatProxy import org.jetbrains.annotations.Nullable -import java.awt.Toolkit +import java.awt.* import java.awt.datatransfer.DataFlavor class PasteAction extends SelectionAction { diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/RenameVariablesAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/RenameVariablesAction.groovy index 7e714767..94741f60 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/RenameVariablesAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/code/RenameVariablesAction.groovy @@ -6,7 +6,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.project.Project -import com.simiacryptus.openai.proxy.ChatProxy +import com.simiacryptus.jopenai.proxy.ChatProxy import org.jetbrains.annotations.Nullable class RenameVariablesAction extends SelectionAction { diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/AnalogueFileAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/AnalogueFileAction.groovy index 197bab6a..62a84502 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/AnalogueFileAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/AnalogueFileAction.groovy @@ -5,8 +5,8 @@ import com.github.simiacryptus.aicoder.config.AppSettingsState import com.github.simiacryptus.aicoder.config.Name import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.project.Project -import com.simiacryptus.openai.OpenAIClient.ChatMessage -import com.simiacryptus.openai.OpenAIClient.ChatRequest +import com.simiacryptus.jopenai.ApiModel.ChatMessage +import com.simiacryptus.jopenai.ApiModel.ChatRequest import org.apache.commons.io.FileUtils import org.apache.commons.io.IOUtils diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/AppendAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/AppendAction.groovy index ca63f760..3465d2dc 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/AppendAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/AppendAction.groovy @@ -3,7 +3,6 @@ package com.github.simiacryptus.aicoder.actions.generic import com.github.simiacryptus.aicoder.actions.SelectionAction import com.github.simiacryptus.aicoder.config.AppSettingsState import com.intellij.openapi.project.Project -import com.simiacryptus.openai.OpenAIClient import org.jetbrains.annotations.Nullable class AppendAction extends SelectionAction { @@ -18,12 +17,12 @@ class AppendAction extends SelectionAction { def request = settings.createChatRequest() request.temperature = AppSettingsState.instance.temperature request.messages = [ - new OpenAIClient.ChatMessage( - OpenAIClient.Role.system, + new com.simiacryptus.jopenai.ApiModel.ChatMessage( + com.simiacryptus.jopenai.ApiModel.Role.system, "Append text to the end of the user's prompt", null ), - new OpenAIClient.ChatMessage( - OpenAIClient.Role.user, + new com.simiacryptus.jopenai.ApiModel.ChatMessage( + com.simiacryptus.jopenai.ApiModel.Role.user, state.selectedText.toString(), null ) ] diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/CreateFileAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/CreateFileAction.groovy index 22202ea3..1def153f 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/CreateFileAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/CreateFileAction.groovy @@ -5,8 +5,8 @@ import com.github.simiacryptus.aicoder.config.AppSettingsState import com.github.simiacryptus.aicoder.config.Name import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.project.Project -import com.simiacryptus.openai.OpenAIClient.ChatMessage -import com.simiacryptus.openai.OpenAIClient.ChatRequest +import com.simiacryptus.jopenai.ApiModel.ChatMessage +import com.simiacryptus.jopenai.ApiModel.ChatRequest import javax.swing.* diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/ReplaceOptionsAction.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/ReplaceOptionsAction.groovy index a67114a2..1acbbf59 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/ReplaceOptionsAction.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/generic/ReplaceOptionsAction.groovy @@ -5,14 +5,12 @@ import com.github.simiacryptus.aicoder.config.AppSettingsState import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.project.Project -import com.simiacryptus.openai.proxy.ChatProxy -import com.simiacryptus.util.StringUtil +import com.simiacryptus.jopenai.proxy.ChatProxy +import com.simiacryptus.jopenai.util.StringUtil import org.jetbrains.annotations.NotNull import org.jetbrains.annotations.Nullable -import static java.lang.Math.ceil -import static java.lang.Math.log -import static java.lang.Math.pow +import static java.lang.Math.* class ReplaceOptionsAction extends SelectionAction { interface VirtualAPI { diff --git a/src/main/groovy/com/github/simiacryptus/aicoder/actions/markdown/MarkdownImplementActionGroup.groovy b/src/main/groovy/com/github/simiacryptus/aicoder/actions/markdown/MarkdownImplementActionGroup.groovy index c82d5af2..a798a177 100644 --- a/src/main/groovy/com/github/simiacryptus/aicoder/actions/markdown/MarkdownImplementActionGroup.groovy +++ b/src/main/groovy/com/github/simiacryptus/aicoder/actions/markdown/MarkdownImplementActionGroup.groovy @@ -8,7 +8,7 @@ import com.intellij.openapi.actionSystem.ActionGroup import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.project.Project -import com.simiacryptus.openai.proxy.ChatProxy +import com.simiacryptus.jopenai.proxy.ChatProxy class MarkdownImplementActionGroup extends ActionGroup { List markdownLanguages = [ diff --git a/src/main/java/com/github/simiacryptus/aicoder/util/IndentedText.java b/src/main/java/com/github/simiacryptus/aicoder/util/IndentedText.java index 0945cd7a..445d1db9 100644 --- a/src/main/java/com/github/simiacryptus/aicoder/util/IndentedText.java +++ b/src/main/java/com/github/simiacryptus/aicoder/util/IndentedText.java @@ -1,6 +1,6 @@ package com.github.simiacryptus.aicoder.util; -import com.simiacryptus.util.StringUtil; +import com.simiacryptus.jopenai.util.StringUtil; import java.util.Arrays; import java.util.stream.Collectors; 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 9d8eef97..97e40b5c 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/BaseAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/BaseAction.kt @@ -4,7 +4,7 @@ import com.github.simiacryptus.aicoder.util.IdeaOpenAIClient import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent -import com.simiacryptus.openai.OpenAIClient +import com.simiacryptus.jopenai.OpenAIClient import org.slf4j.LoggerFactory import javax.swing.Icon 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 4daeafbc..3499c7bd 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 @@ -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.chat.ChatServer +import com.simiacryptus.skyenet.webui.chat.ChatServer import org.eclipse.jetty.server.Server import org.eclipse.jetty.server.handler.ContextHandlerCollection import org.eclipse.jetty.webapp.WebAppContext 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 c602813d..7c11ba01 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 @@ -3,10 +3,10 @@ import com.github.simiacryptus.aicoder.actions.BaseAction import com.github.simiacryptus.aicoder.actions.dev.AppServer import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.simiacryptus.skyenet.chat.CodeChatServer import com.github.simiacryptus.aicoder.util.ComputerLanguage import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys +import com.simiacryptus.skyenet.webui.chat.CodeChatServer import org.slf4j.LoggerFactory import java.awt.Desktop import java.util.* 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 7e3df1e2..fe068ddf 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,8 +6,8 @@ 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.simiacryptus.util.audio.AudioRecorder -import com.simiacryptus.util.audio.LookbackLoudnessWindowBuffer +import com.simiacryptus.jopenai.audio.AudioRecorder +import com.simiacryptus.jopenai.audio.LookbackLoudnessWindowBuffer import org.slf4j.LoggerFactory import java.util.* import java.util.concurrent.ConcurrentLinkedDeque diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/markdown/MarkdownListAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/markdown/MarkdownListAction.kt index e9aa3d20..48d95bf5 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/markdown/MarkdownListAction.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/markdown/MarkdownListAction.kt @@ -11,8 +11,8 @@ import com.github.simiacryptus.aicoder.util.psi.PsiUtil.getSmallestIntersecting import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.application.ApplicationManager -import com.simiacryptus.openai.proxy.ChatProxy -import com.simiacryptus.util.StringUtil +import com.simiacryptus.jopenai.proxy.ChatProxy +import com.simiacryptus.jopenai.util.StringUtil class MarkdownListAction : BaseAction() { 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 e0012993..b9d958c1 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt @@ -10,8 +10,9 @@ import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.ui.components.JBCheckBox import com.intellij.ui.components.JBPasswordField import com.intellij.ui.components.JBTextField -import com.simiacryptus.openai.models.ChatModels -import com.simiacryptus.openai.OpenAIClientBase +import com.simiacryptus.jopenai.ClientUtil +import com.simiacryptus.jopenai.models.ChatModels + import org.slf4j.LoggerFactory import java.awt.event.ActionEvent import javax.swing.AbstractAction @@ -57,7 +58,7 @@ class AppSettingsComponent { @Suppress("unused") val openApiLog = JButton(object : AbstractAction("Open API Log") { override fun actionPerformed(e: ActionEvent) { - OpenAIClientBase.auxiliaryLog?.let { + ClientUtil.auxiliaryLog?.let { val project = ApplicationManager.getApplication().runReadAction { com.intellij.openapi.project.ProjectManager.getInstance().openProjects.firstOrNull() } diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsState.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsState.kt index a7a1df92..2010759a 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsState.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsState.kt @@ -6,11 +6,11 @@ import com.intellij.openapi.components.PersistentStateComponent import com.intellij.openapi.components.State import com.intellij.openapi.components.Storage import com.intellij.util.xmlb.XmlSerializerUtil -import com.simiacryptus.openai.models.OpenAIModel -import com.simiacryptus.openai.models.ChatModels -import com.simiacryptus.openai.OpenAIClient.ChatRequest -import com.simiacryptus.openai.models.OpenAITextModel -import com.simiacryptus.util.JsonUtil +import com.simiacryptus.jopenai.ApiModel.ChatRequest +import com.simiacryptus.jopenai.models.ChatModels +import com.simiacryptus.jopenai.models.OpenAIModel +import com.simiacryptus.jopenai.models.OpenAITextModel +import com.simiacryptus.jopenai.util.JsonUtil class SimpleEnvelope(var value: String? = null) diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/MRUItems.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/config/MRUItems.kt index 78a519a9..6a78777d 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/MRUItems.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/config/MRUItems.kt @@ -1,8 +1,5 @@ package com.github.simiacryptus.aicoder.config -import java.util.ArrayList -import java.util.HashMap -import java.util.HashSet import java.util.Map import java.util.stream.Collectors 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 0811dbd8..bed8463a 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/ModelSelectionWidgetFactory.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/ui/ModelSelectionWidgetFactory.kt @@ -9,7 +9,7 @@ import com.intellij.openapi.wm.StatusBarWidgetFactory import com.intellij.ui.CollectionListModel import com.intellij.ui.SimpleListCellRenderer import com.intellij.ui.popup.list.ComboBoxPopup -import com.simiacryptus.openai.models.ChatModels +import com.simiacryptus.jopenai.models.ChatModels import kotlinx.coroutines.CoroutineScope import javax.swing.JList import javax.swing.ListCellRenderer 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 cb9e27f0..a463b64b 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TemperatureControlWidgetFactory.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TemperatureControlWidgetFactory.kt @@ -20,7 +20,10 @@ import java.awt.event.MouseAdapter import java.awt.event.MouseEvent import java.net.URI import java.util.concurrent.Executors -import javax.swing.* +import javax.swing.Icon +import javax.swing.JPanel +import javax.swing.JSlider +import javax.swing.JTabbedPane import javax.swing.event.ChangeEvent import javax.swing.event.ChangeListener 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 b0be934a..3a92ff52 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt @@ -12,10 +12,12 @@ import com.intellij.openapi.vfs.readText import com.intellij.openapi.wm.StatusBar import com.intellij.openapi.wm.StatusBarWidget import com.intellij.openapi.wm.StatusBarWidgetFactory -import com.simiacryptus.openai.GPT4Tokenizer +import com.simiacryptus.jopenai.GPT4Tokenizer import kotlinx.coroutines.CoroutineScope import java.awt.event.MouseEvent -import java.util.concurrent.* +import java.util.concurrent.LinkedBlockingDeque +import java.util.concurrent.ThreadPoolExecutor +import java.util.concurrent.TimeUnit class TokenCountWidgetFactory : StatusBarWidgetFactory { companion object { diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/BlockComment.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/util/BlockComment.kt index 56e03e3c..6137f013 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/BlockComment.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/util/BlockComment.kt @@ -2,7 +2,7 @@ package com.github.simiacryptus.aicoder.util -import com.simiacryptus.util.StringUtil +import com.simiacryptus.jopenai.util.StringUtil import java.util.* import java.util.stream.Collectors diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/ComputerLanguage.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/util/ComputerLanguage.kt index 286e8caa..ba934bfb 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/ComputerLanguage.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/util/ComputerLanguage.kt @@ -1,6 +1,5 @@ package com.github.simiacryptus.aicoder.util -import com.intellij.lang.Language import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys import java.util.* 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 920277de..cb9bdef9 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaOpenAIClient.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaOpenAIClient.kt @@ -1,6 +1,5 @@ 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 @@ -8,10 +7,11 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.ui.DialogWrapper import com.intellij.ui.components.JBScrollPane import com.intellij.util.ui.FormBuilder -import com.simiacryptus.openai.models.OpenAIModel -import com.simiacryptus.openai.OpenAIClient -import com.simiacryptus.openai.models.OpenAITextModel -import com.simiacryptus.util.JsonUtil +import com.simiacryptus.jopenai.ApiModel.* +import com.simiacryptus.jopenai.OpenAIClient +import com.simiacryptus.jopenai.models.OpenAIModel +import com.simiacryptus.jopenai.models.OpenAITextModel +import com.simiacryptus.jopenai.util.JsonUtil import org.apache.hc.core5.http.HttpRequest import org.slf4j.LoggerFactory import java.util.concurrent.atomic.AtomicBoolean @@ -34,6 +34,7 @@ class IdeaOpenAIClient : OpenAIClient( super.authorize(request) } + @Suppress("NAME_SHADOWING") override fun chat( chatRequest: ChatRequest, model: OpenAITextModel @@ -54,8 +55,7 @@ class IdeaOpenAIClient : OpenAIClient( """.trimMargin().trim()) return response } - return withJsonDialog(chatRequest, { - val chatRequest = it + return withJsonDialog(chatRequest, { chatRequest -> UITools.run( lastEvent!!.project, "OpenAI Request", true, suppressProgress = false ) { diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/LineComment.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/util/LineComment.kt index fdbaa598..6908063d 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/LineComment.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/util/LineComment.kt @@ -1,8 +1,8 @@ package com.github.simiacryptus.aicoder.util -import com.simiacryptus.util.StringUtil.getWhitespacePrefix -import com.simiacryptus.util.StringUtil.stripPrefix -import com.simiacryptus.util.StringUtil.trimPrefix +import com.simiacryptus.jopenai.util.StringUtil.getWhitespacePrefix +import com.simiacryptus.jopenai.util.StringUtil.stripPrefix +import com.simiacryptus.jopenai.util.StringUtil.trimPrefix import java.util.* import java.util.stream.Collectors diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/UITools.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/util/UITools.kt index 005b2816..84e82a2f 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/UITools.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/util/UITools.kt @@ -30,9 +30,9 @@ import com.intellij.ui.components.JBPasswordField import com.intellij.ui.components.JBScrollPane import com.intellij.ui.components.JBTextArea import com.intellij.util.ui.FormBuilder -import com.simiacryptus.openai.exceptions.ModerationException -import com.simiacryptus.openai.OpenAIClient -import com.simiacryptus.util.StringUtil +import com.simiacryptus.jopenai.OpenAIClient +import com.simiacryptus.jopenai.exceptions.ModerationException +import com.simiacryptus.jopenai.util.StringUtil import groovy.lang.GroovyRuntimeException import org.jdesktop.swingx.JXButton import org.slf4j.LoggerFactory 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 99d5da98..937970fa 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 @@ -9,7 +9,7 @@ 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 com.simiacryptus.jopenai.proxy.ChatProxy import org.slf4j.LoggerFactory import java.util.* import java.util.concurrent.ExecutionException @@ -84,7 +84,7 @@ class PsiTranslationTree( } } - fun translateTree( + private fun translateTree( project: Project, indent: CharSequence, ) { @@ -94,7 +94,7 @@ class PsiTranslationTree( } } - fun getTranslatedDocument(): CharSequence = try { + private fun getTranslatedDocument(): CharSequence = try { var translated = translatedResult.toString() if (!stubs.isEmpty()) { log.warn( diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiUtil.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiUtil.kt index ba5a4495..a3c301aa 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiUtil.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiUtil.kt @@ -5,7 +5,7 @@ import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElement import com.intellij.psi.PsiElementVisitor -import com.simiacryptus.util.StringUtil +import com.simiacryptus.jopenai.util.StringUtil import java.util.* import java.util.concurrent.atomic.AtomicReference import java.util.stream.Collectors diff --git a/src/main/kotlin/com/simiacryptus/skyenet/heart/WeakGroovyInterpreter.kt b/src/main/kotlin/com/simiacryptus/skyenet/heart/WeakGroovyInterpreter.kt index a0a89ab7..5b3d734c 100644 --- a/src/main/kotlin/com/simiacryptus/skyenet/heart/WeakGroovyInterpreter.kt +++ b/src/main/kotlin/com/simiacryptus/skyenet/heart/WeakGroovyInterpreter.kt @@ -2,7 +2,7 @@ package com.simiacryptus.skyenet.heart -import com.simiacryptus.skyenet.Heart +import com.simiacryptus.skyenet.core.Heart import java.lang.reflect.Method @Suppress("unused") diff --git a/src/main/kotlin/com/simiacryptus/skyenet/heart/WeakKotlinInterpreter.kt b/src/main/kotlin/com/simiacryptus/skyenet/heart/WeakKotlinInterpreter.kt index 5827ef99..7c5f1e7a 100644 --- a/src/main/kotlin/com/simiacryptus/skyenet/heart/WeakKotlinInterpreter.kt +++ b/src/main/kotlin/com/simiacryptus/skyenet/heart/WeakKotlinInterpreter.kt @@ -1,6 +1,6 @@ package com.simiacryptus.skyenet.heart -import com.simiacryptus.skyenet.Heart +import com.simiacryptus.skyenet.core.Heart import java.lang.reflect.Method @Suppress("unused") diff --git a/src/main/resources/META-INF/pluginIcon.svg b/src/main/resources/META-INF/pluginIcon.svg index b0ee309c..ea9d3e0c 100644 --- a/src/main/resources/META-INF/pluginIcon.svg +++ b/src/main/resources/META-INF/pluginIcon.svg @@ -1,5 +1,5 @@  -