Skip to content

Commit

Permalink
1.2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski committed Nov 17, 2023
1 parent c66c532 commit 3ac3a6c
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

- Fixed settings for service port

### Removed

- Country sanctioning logic

## [1.2.19]

### Fixed
Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<Project> {
com.intellij.openapi.project.ProjectManager.getInstance().openProjects.firstOrNull()
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -23,7 +23,7 @@ class AppSettingsState : PersistentStateComponent<SimpleEnvelope> {
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
Expand All @@ -38,14 +38,12 @@ class AppSettingsState : PersistentStateComponent<SimpleEnvelope> {
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,9 +15,9 @@ open class ActionTestBase {
companion object {

fun <T:Any>testScript_SelectionAction(selectionAction: SelectionAction<T>, 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)
?: ""
Expand Down Expand Up @@ -61,9 +63,9 @@ open class ActionTestBase {
selectionAction: FileContextAction<T>,
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)
?: ""
Expand Down

0 comments on commit 3ac3a6c

Please sign in to comment.