diff --git a/CHANGELOG.md b/CHANGELOG.md index 088edf87..270a8883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ - Fixed settings for service port +### Removed + +- Country sanctioning logic + ## [1.2.19] ### Fixed diff --git a/README.md b/README.md index 579d4b2b..7bc75bc5 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,6 @@ * Toolbar UI for quick configuration of temperature/model and display of current token count * Ability to intercept, edit, and log API requests -**NOTE**: Due to the war of aggression, widespread war crimes including acts of genocide committed by the Russian -Federation against Ukraine and various other countries, this plugin will not function for users in Russia and allied countries. -_We are working on a solution to this problem_, but cannot yet promise a date for the victory. -**_Slava Ukraini!_** - **NOTE**: This project is not affiliated with OpenAI, JetBrains, or any other corporation or organization. It is provided free of charge, as-is, with no warranty or guarantee of any kind. diff --git a/build.gradle.kts b/build.gradle.kts index 5a37fa57..d986c5d7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,7 +28,7 @@ val slf4j_version = "2.0.9" val skyenet_version = "1.0.31" dependencies { - implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.28") + implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.29") 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/config/AppSettingsComponent.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt index 67815046..3fce9456 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt @@ -11,7 +11,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 import com.simiacryptus.openai.OpenAIClient +import com.simiacryptus.openai.OpenAIClientBase import java.awt.event.ActionEvent import javax.swing.AbstractAction import javax.swing.JButton @@ -56,7 +58,7 @@ class AppSettingsComponent { @Suppress("unused") val openApiLog = JButton(object : AbstractAction("Open API Log") { override fun actionPerformed(e: ActionEvent) { - OpenAIClient.auxillaryLog?.let { + OpenAIClientBase.auxillaryLog?.let { val project = ApplicationManager.getApplication().runReadAction { com.intellij.openapi.project.ProjectManager.getInstance().openProjects.firstOrNull() } @@ -102,9 +104,9 @@ class AppSettingsComponent { init { tokenCounter.isEditable = false - this.modelName.addItem(OpenAIClient.Models.GPT35Turbo.modelName) - this.modelName.addItem(OpenAIClient.Models.GPT4.modelName) - this.modelName.addItem(OpenAIClient.Models.GPT4Turbo.modelName) + this.modelName.addItem(Models.GPT35Turbo.modelName) + this.modelName.addItem(Models.GPT4.modelName) + this.modelName.addItem(Models.GPT4Turbo.modelName) } val preferredFocusedComponent: JComponent 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 79194ada..66fe3619 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsState.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsState.kt @@ -6,10 +6,10 @@ 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.OpenAIClient +import com.simiacryptus.openai.Model +import com.simiacryptus.openai.Models import com.simiacryptus.openai.OpenAIClient.ChatRequest import com.simiacryptus.util.JsonUtil -import java.util.* class SimpleEnvelope(var value: String? = null) @@ -23,7 +23,7 @@ class AppSettingsState : PersistentStateComponent { var apiBase = "https://api.openai.com/v1" var apiKey = "" var temperature = 0.1 - var modelName : String = OpenAIClient.Models.GPT35Turbo.modelName + var modelName : String = Models.GPT35Turbo.modelName var tokenCounter = 0 var humanLanguage = "English" var devActions = false @@ -38,14 +38,12 @@ class AppSettingsState : PersistentStateComponent { return createChatRequest(defaultChatModel()) } - fun defaultChatModel() = OpenAIClient.Models.entries.first { it.modelName == modelName } + fun defaultChatModel() = Models.entries.first { it.modelName == modelName } - private fun createChatRequest(model: OpenAIClient.Model): ChatRequest { - val chatRequest = ChatRequest() - chatRequest.model = model.modelName - chatRequest.temperature = temperature - return chatRequest - } + private fun createChatRequest(model: Model): ChatRequest = ChatRequest( + model = model.modelName, + temperature = temperature + ) @JsonIgnore override fun getState(): SimpleEnvelope { 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 848f7adf..5c5934bd 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/ModelSelectionWidgetFactory.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/ui/ModelSelectionWidgetFactory.kt @@ -10,6 +10,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 import com.simiacryptus.openai.OpenAIClient import kotlinx.coroutines.CoroutineScope import javax.swing.JList @@ -26,9 +27,9 @@ class ModelSelectionWidgetFactory : StatusBarWidgetFactory { private var statusBar: StatusBar? = null private var activeModel: String = AppSettingsState.instance.defaultChatModel().modelName val models = listOf( - OpenAIClient.Models.GPT4Turbo, - OpenAIClient.Models.GPT4, - OpenAIClient.Models.GPT35Turbo, + Models.GPT4Turbo, + Models.GPT4, + Models.GPT35Turbo, ) override fun ID(): String { 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 7dbad08a..e9b0ba54 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaOpenAIClient.kt +++ b/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaOpenAIClient.kt @@ -7,6 +7,7 @@ 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.Model import com.simiacryptus.openai.OpenAIClient import com.simiacryptus.util.JsonUtil import org.apache.http.client.methods.HttpRequestBase diff --git a/src/test/kotlin/com/github/simiacryptus/aicoder/actions/ActionTestBase.kt b/src/test/kotlin/com/github/simiacryptus/aicoder/actions/ActionTestBase.kt index 72d7997c..85fd12f4 100644 --- a/src/test/kotlin/com/github/simiacryptus/aicoder/actions/ActionTestBase.kt +++ b/src/test/kotlin/com/github/simiacryptus/aicoder/actions/ActionTestBase.kt @@ -3,7 +3,9 @@ import com.github.simiacryptus.aicoder.config.AppSettingsState import com.github.simiacryptus.aicoder.util.ComputerLanguage import com.github.simiacryptus.aicoder.util.MarkdownProcessor +import com.simiacryptus.openai.Models import com.simiacryptus.openai.OpenAIClient +import com.simiacryptus.openai.OpenAIClientBase import com.simiacryptus.util.JsonUtil import org.junit.jupiter.api.Assertions import java.io.File @@ -13,9 +15,9 @@ open class ActionTestBase { companion object { fun testScript_SelectionAction(selectionAction: SelectionAction, scriptPath: String) { - AppSettingsState.instance.apiKey = OpenAIClient.keyTxt + AppSettingsState.instance.apiKey = OpenAIClientBase.keyTxt AppSettingsState.instance.temperature = 0.0 - AppSettingsState.instance.modelName = OpenAIClient.Models.GPT35Turbo.name + AppSettingsState.instance.modelName = Models.GPT35Turbo.name val input = selectionAction.javaClass.getResourceAsStream(scriptPath)?.readAllBytes()?.toString(Charsets.UTF_8) ?: "" @@ -61,9 +63,9 @@ open class ActionTestBase { selectionAction: FileContextAction, scriptPath: String ) { - AppSettingsState.instance.apiKey = OpenAIClient.keyTxt + AppSettingsState.instance.apiKey = OpenAIClientBase.keyTxt AppSettingsState.instance.temperature = 0.0 - AppSettingsState.instance.modelName = OpenAIClient.Models.GPT35Turbo.name + AppSettingsState.instance.modelName = Models.GPT35Turbo.name val input = selectionAction.javaClass.getResourceAsStream(scriptPath)?.readAllBytes()?.toString(Charsets.UTF_8) ?: ""