Skip to content

Commit

Permalink
1.3.4 (#140)
Browse files Browse the repository at this point in the history
* 1.3.4

* 1.3.4

* 1.3.4

* wip

* Update TaskRunnerAction.kt

* Update DiffChatAction.kt
  • Loading branch information
acharneski authored Mar 25, 2024
1 parent 5e879eb commit 9327da6
Show file tree
Hide file tree
Showing 32 changed files with 738 additions and 492 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repositories {
val kotlin_version = "1.9.21"
val jetty_version = "11.0.18"
val slf4j_version = "2.0.9"
val skyenet_version = "1.0.53"
val skyenet_version = "1.0.55"
val remoterobot_version = "0.11.21"
dependencies {

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginName=intellij-aicoder
pluginRepositoryUrl=https://github.com/SimiaCryptus/intellij-aicoder
pluginVersion=1.3.3
pluginVersion=1.3.4

jvmArgs=-Xmx8g
org.gradle.jvmargs=-Xmx8g
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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.config.AppSettingsState.Companion.chatModel
import com.github.simiacryptus.aicoder.util.ComputerLanguage
import com.intellij.openapi.project.Project
import com.simiacryptus.jopenai.proxy.ChatProxy
Expand All @@ -18,11 +19,11 @@ class CommentsAction : SelectionAction<String>() {

override fun processSelection(state: SelectionState, config: String?): String {
return ChatProxy(
clazz = CommentsAction_VirtualAPI::class.java,
api = api,
temperature = AppSettingsState.instance.temperature,
model = AppSettingsState.instance.defaultChatModel(),
deserializerRetries = 5
clazz = CommentsAction_VirtualAPI::class.java,
api = api,
temperature = AppSettingsState.instance.temperature,
model = AppSettingsState.instance.smartModel.chatModel(),
deserializerRetries = 5
).create().editCode(
state.selectedText ?: "",
"Add comments to each line explaining the code",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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.config.AppSettingsState.Companion.chatModel
import com.github.simiacryptus.aicoder.util.UITools
import com.intellij.openapi.project.Project
import com.simiacryptus.jopenai.proxy.ChatProxy
Expand All @@ -25,10 +26,10 @@ open class CustomEditAction : SelectionAction<String>() {

val proxy: VirtualAPI get() {
val chatProxy = ChatProxy(
clazz = VirtualAPI::class.java,
api = api,
temperature = AppSettingsState.instance.temperature,
model = AppSettingsState.instance.defaultChatModel(),
clazz = VirtualAPI::class.java,
api = api,
temperature = AppSettingsState.instance.temperature,
model = AppSettingsState.instance.smartModel.chatModel(),
)
chatProxy.addExample(
VirtualAPI.EditedText(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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.config.AppSettingsState.Companion.chatModel
import com.github.simiacryptus.aicoder.util.IndentedText
import com.intellij.openapi.project.Project
import com.simiacryptus.jopenai.proxy.ChatProxy
Expand All @@ -24,11 +25,11 @@ class DescribeAction : SelectionAction<String>() {

private val proxy: DescribeAction_VirtualAPI
get() = ChatProxy(
clazz = DescribeAction_VirtualAPI::class.java,
api = api,
temperature = AppSettingsState.instance.temperature,
model = AppSettingsState.instance.defaultChatModel(),
deserializerRetries = 5
clazz = DescribeAction_VirtualAPI::class.java,
api = api,
temperature = AppSettingsState.instance.temperature,
model = AppSettingsState.instance.smartModel.chatModel(),
deserializerRetries = 5
).create()

override fun getConfig(project: Project?): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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.config.AppSettingsState.Companion.chatModel
import com.github.simiacryptus.aicoder.util.ComputerLanguage
import com.github.simiacryptus.aicoder.util.IndentedText
import com.github.simiacryptus.aicoder.util.psi.PsiUtil
Expand All @@ -26,11 +27,11 @@ class DocAction : SelectionAction<String>() {

private val proxy: DocAction_VirtualAPI by lazy {
val chatProxy = ChatProxy(
clazz = DocAction_VirtualAPI::class.java,
api = api,
model = AppSettingsState.instance.defaultChatModel(),
temperature = AppSettingsState.instance.temperature,
deserializerRetries = 5
clazz = DocAction_VirtualAPI::class.java,
api = api,
model = AppSettingsState.instance.smartModel.chatModel(),
temperature = AppSettingsState.instance.temperature,
deserializerRetries = 5
)
chatProxy.addExample(
DocAction_VirtualAPI.DocAction_ConvertedText().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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.config.AppSettingsState.Companion.chatModel
import com.github.simiacryptus.aicoder.util.ComputerLanguage
import com.github.simiacryptus.aicoder.util.psi.PsiUtil
import com.intellij.openapi.project.Project
Expand All @@ -27,11 +28,11 @@ class ImplementStubAction : SelectionAction<String>() {

private fun getProxy(): VirtualAPI {
return ChatProxy(
clazz = VirtualAPI::class.java,
api = api,
model = AppSettingsState.instance.defaultChatModel(),
temperature = AppSettingsState.instance.temperature,
deserializerRetries = 5
clazz = VirtualAPI::class.java,
api = api,
model = AppSettingsState.instance.smartModel.chatModel(),
temperature = AppSettingsState.instance.temperature,
deserializerRetries = 5
).create()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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.config.AppSettingsState.Companion.chatModel
import com.github.simiacryptus.aicoder.util.ComputerLanguage
import com.github.simiacryptus.aicoder.util.TextBlock
import com.github.simiacryptus.aicoder.util.UITools
Expand Down Expand Up @@ -29,11 +30,11 @@ class InsertImplementationAction : SelectionAction<String>() {

private fun getProxy(): VirtualAPI {
return ChatProxy(
clazz = VirtualAPI::class.java,
api = api,
model = AppSettingsState.instance.defaultChatModel(),
temperature = AppSettingsState.instance.temperature,
deserializerRetries = 5
clazz = VirtualAPI::class.java,
api = api,
model = AppSettingsState.instance.smartModel.chatModel(),
temperature = AppSettingsState.instance.temperature,
deserializerRetries = 5
).create()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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.config.AppSettingsState.Companion.chatModel
import com.github.simiacryptus.aicoder.util.ComputerLanguage
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.Project
Expand All @@ -28,7 +29,7 @@ open class PasteAction : SelectionAction<String>(false) {
return ChatProxy(
VirtualAPI::class.java,
api,
AppSettingsState.instance.defaultChatModel(),
AppSettingsState.instance.smartModel.chatModel(),
AppSettingsState.instance.temperature,
).create().convert(
getClipboard().toString().trim(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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.config.AppSettingsState.Companion.chatModel
import com.github.simiacryptus.aicoder.util.ComputerLanguage
import com.github.simiacryptus.aicoder.util.UITools
import com.intellij.openapi.actionSystem.AnActionEvent
Expand Down Expand Up @@ -29,11 +30,11 @@ open class RenameVariablesAction : SelectionAction<String>() {

val proxy: RenameAPI get() {
return ChatProxy(
clazz = RenameAPI::class.java,
api = api,
model = AppSettingsState.instance.defaultChatModel(),
temperature = AppSettingsState.instance.temperature,
deserializerRetries = 5
clazz = RenameAPI::class.java,
api = api,
model = AppSettingsState.instance.smartModel.chatModel(),
temperature = AppSettingsState.instance.temperature,
deserializerRetries = 5
).create()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.github.simiacryptus.aicoder.ApplicationEvents
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.IdeaKotlinInterpreter
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
Expand Down Expand Up @@ -52,7 +53,7 @@ class InternalCoderAction : BaseAction() {
symbols = symbols,
temperature = 0.1,
details = "Ensure that responses are printed; this is not a REPL.",
model = AppSettingsState.instance.defaultChatModel(),
model = AppSettingsState.instance.smartModel.chatModel(),
)

Thread {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.github.simiacryptus.aicoder.actions.generic

import com.github.simiacryptus.aicoder.actions.FileContextAction
import com.github.simiacryptus.aicoder.config.AppSettingsState
import com.github.simiacryptus.aicoder.config.AppSettingsState.Companion.chatModel
import com.github.simiacryptus.aicoder.config.Name
import com.github.simiacryptus.aicoder.util.UITools
import com.intellij.openapi.application.ApplicationManager
Expand Down Expand Up @@ -89,7 +90,7 @@ class AnalogueFileAction : FileContextAction<AnalogueFileAction.Settings>() {
}

private fun generateFile(baseFile: ProjectFile, directive: String): ProjectFile {
val model = AppSettingsState.instance.defaultChatModel()
val model = AppSettingsState.instance.smartModel.chatModel()
val chatRequest = ApiModel.ChatRequest(
model = model.modelName,
temperature = AppSettingsState.instance.temperature,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.simiacryptus.aicoder.actions.SelectionAction
import com.github.simiacryptus.aicoder.config.AppSettingsState
import com.github.simiacryptus.aicoder.config.AppSettingsState.Companion.chatModel
import com.intellij.openapi.project.Project
import com.simiacryptus.jopenai.ApiModel.*
import com.simiacryptus.jopenai.util.ClientUtil.toContentList
Expand All @@ -14,16 +15,16 @@ import com.simiacryptus.jopenai.util.ClientUtil.toContentList
override fun processSelection(state: SelectionState, config: String?): String {
val settings = AppSettingsState.instance
val request = ChatRequest(
model = settings.defaultChatModel().modelName,
temperature = settings.temperature
model = settings.smartModel.chatModel().modelName,
temperature = settings.temperature
).copy(
temperature = settings.temperature,
messages = listOf(
ChatMessage(Role.system, "Append text to the end of the user's prompt".toContentList(), null),
ChatMessage(Role.user, state.selectedText.toString().toContentList(), null)
),
)
val chatResponse = api.chat(request, settings.defaultChatModel())
val chatResponse = api.chat(request, settings.smartModel.chatModel())
val b4 = state.selectedText ?: ""
val str = chatResponse.choices[0].message?.content ?: ""
return b4 + if (str.startsWith(b4)) str.substring(b4.length) else str
Expand Down
Loading

0 comments on commit 9327da6

Please sign in to comment.