Skip to content

Commit

Permalink
1.8.2 (#196)
Browse files Browse the repository at this point in the history
* 1.8.2

* 1.8.2

* 1.8.2

* 1.8.2
  • Loading branch information
acharneski authored Oct 28, 2024
1 parent 4ea41d1 commit 5d35874
Show file tree
Hide file tree
Showing 16 changed files with 315 additions and 438 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repositories {

val jetty_version = "11.0.24"
val slf4j_version = "2.0.16"
val skyenet_version = "1.2.13"
val skyenet_version = "1.2.14"
val remoterobot_version = "0.11.23"
val jackson_version = "2.17.2"

Expand All @@ -43,7 +43,7 @@ dependencies {
implementation("com.googlecode.java-diff-utils:diffutils:1.3.0")
implementation(group = "org.apache.httpcomponents.client5", name = "httpclient5", version = "5.2.3")

implementation(group = "com.simiacryptus", name = "jo-penai", version = "1.1.10")
implementation(group = "com.simiacryptus", name = "jo-penai", version = "1.1.11")
implementation(group = "com.simiacryptus.skyenet", name = "kotlin", version = skyenet_version)
implementation(group = "com.simiacryptus.skyenet", name = "core", version = skyenet_version)
implementation(group = "com.simiacryptus.skyenet", name = "webui", version = skyenet_version)
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.8.1
pluginVersion=1.8.2
jvmArgs=-Xmx8g
org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=1g
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ class AutoPlanChatAction : BaseAction() {
),
temperature = AppSettingsState.instance.temperature,
workingDir = UITools.getSelectedFolder(e)?.toFile?.absolutePath ?: "",
env = mapOf()
env = mapOf(),
githubToken = AppSettingsState.instance.githubToken,
googleApiKey = AppSettingsState.instance.googleApiKey,
googleSearchEngineId = AppSettingsState.instance.googleSearchEngineId,
)
)
if (dialog.showAndGet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import com.simiacryptus.skyenet.webui.application.AppInfoData
import com.simiacryptus.skyenet.webui.application.ApplicationServer
import com.simiacryptus.skyenet.webui.application.ApplicationSocketManager
import com.simiacryptus.skyenet.webui.session.SocketManager
import com.simiacryptus.skyenet.webui.session.SocketManagerBase
import java.awt.BorderLayout
import java.awt.Dimension
import java.nio.file.Files
Expand All @@ -47,6 +46,7 @@ import javax.swing.JComboBox
import javax.swing.JComponent
import javax.swing.JLabel
import javax.swing.JPanel
import javax.swing.JCheckBox

class MassPatchAction : BaseAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
Expand All @@ -64,17 +64,20 @@ class MassPatchAction : BaseAction() {

@Name("Recent Instructions")
val recentInstructions = JComboBox<String>()
@Name("Auto Apply")
val autoApply = JCheckBox("Auto Apply Changes")

}

class UserSettings(
var transformationMessage: String = "Review, fix, and improve",
var filesToProcess: List<Path> = listOf(),
var autoApply: Boolean = false,
)

class Settings(
val settings: UserSettings? = null,
val project: Project? = null
val project: Project? = null,
)

fun getConfig(project: Project?, e: AnActionEvent): Settings? {
Expand All @@ -89,6 +92,7 @@ class MassPatchAction : BaseAction() {
files.forEach { path ->
filesToProcess.setItemSelected(path, true)
}
autoApply.isSelected = false
}
val mruPatchInstructions = AppSettingsState.instance.getRecentCommands("PatchInstructions")
settingsUI.recentInstructions.model = DefaultComboBoxModel(
Expand Down Expand Up @@ -121,6 +125,7 @@ class MassPatchAction : BaseAction() {
val config = getConfig(project, e)

val session = Session.newGlobalID()
SessionProxyServer.chats[session] = MassPatchServer(config=config!!, api=api, autoApply = config.settings?.autoApply ?: false)
ApplicationServer.appInfoMap[session] = AppInfoData(
applicationName = "Code Chat",
singleInput = true,
Expand Down Expand Up @@ -150,6 +155,7 @@ class MassPatchAction : BaseAction() {
this.title = title
// Set the default values for the UI elements from userSettings
settingsUI.transformationMessage.text = userSettings.transformationMessage
settingsUI.autoApply.isSelected = userSettings.autoApply
init()
}

Expand All @@ -168,6 +174,8 @@ class MassPatchAction : BaseAction() {
add(Box.createVerticalStrut(10))
add(JLabel("AI Instruction"))
add(settingsUI.transformationMessage)
add(Box.createVerticalStrut(10))
add(settingsUI.autoApply)
}
add(optionsPanel, BorderLayout.SOUTH)
}
Expand All @@ -179,13 +187,15 @@ class MassPatchAction : BaseAction() {
userSettings.transformationMessage = settingsUI.transformationMessage.text
userSettings.filesToProcess =
settingsUI.filesToProcess.items.filter { path -> settingsUI.filesToProcess.isItemSelected(path) }
userSettings.autoApply = settingsUI.autoApply.isSelected
}
}
}

class MassPatchServer(
val config: Settings,
val api: ChatClient
val api: ChatClient,
val autoApply: Boolean
) : ApplicationServer(
applicationName = "Multi-file Patch Chat",
path = "/patchChat",
Expand Down Expand Up @@ -286,17 +296,18 @@ class MassPatchServer(
mainActor.answer(toInput(it), api = api)
},
outputFn = { design: String ->
var markdown = (ui as SocketManagerBase).addApplyFileDiffLinks(
root = _root as Path,
response = design as String,
var markdown = ui.socketManager?.addApplyFileDiffLinks(
root = _root,
response = design,
handle = { newCodeMap: Map<Path, String> ->
newCodeMap.forEach { (path, newCode) ->
fileTask.complete("<a href='${"fileIndex/$session/$path"}'>$path</a> Updated")
}
} as (Map<Path, String>) -> Unit,
},
ui = ui,
api = api as API,
shouldAutoApply = { true } as (Path) -> Boolean,
shouldAutoApply = { autoApply },
model = AppSettingsState.instance.fastModel.chatModel(),
)
"""<div>${renderMarkdown(markdown!!)}</div>"""
},
Expand All @@ -318,12 +329,11 @@ class MassPatchServer(
}
}
}, 10, java.util.concurrent.TimeUnit.MILLISECONDS)

}
return socketManager
}

companion object {
val log = org.slf4j.LoggerFactory.getLogger(MassPatchServer::class.java)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ class PlanAheadAction : BaseAction() {
),
temperature = AppSettingsState.instance.temperature,
workingDir = UITools.getSelectedFolder(e)?.toFile?.absolutePath ?: "",
env = mapOf()
env = mapOf(),
githubToken = AppSettingsState.instance.githubToken,
googleApiKey = AppSettingsState.instance.googleApiKey,
googleSearchEngineId = AppSettingsState.instance.googleSearchEngineId,
)
)
if (dialog.showAndGet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ class PlanChatAction : BaseAction() {
),
temperature = AppSettingsState.instance.temperature,
workingDir = UITools.getSelectedFolder(e)?.toFile?.absolutePath ?: "",
env = mapOf()
env = mapOf(),
githubToken = AppSettingsState.instance.githubToken,
googleApiKey = AppSettingsState.instance.googleApiKey,
googleSearchEngineId = AppSettingsState.instance.googleSearchEngineId,
)
)
if (dialog.showAndGet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class PrePlanAction : BaseAction() {
workingDir = root.absolutePath,
env = mapOf(),
language = if (isWindows) "powershell" else "bash",
githubToken = AppSettingsState.instance.githubToken,
googleApiKey = AppSettingsState.instance.googleApiKey,
googleSearchEngineId = AppSettingsState.instance.googleSearchEngineId,
)
planSettings = PlanAheadConfigDialog(e.project, planSettings).let {
if (!it.showAndGet()) throw RuntimeException("User cancelled")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ import javax.swing.table.DefaultTableCellRenderer
import javax.swing.table.DefaultTableModel

class AppSettingsComponent : com.intellij.openapi.Disposable {
@Suppress("unused")
@Name("GitHub Token")
val githubToken = JBTextField().apply {
toolTipText = "GitHub Personal Access Token"
columns = 30
}
@Suppress("unused")
@Name("Google API Key")
val googleApiKey = JBTextField().apply {
toolTipText = "Google API Key"
columns = 30
}
@Suppress("unused")
@Name("Google Search Engine ID")
val googleSearchEngineId = JBTextField().apply {
toolTipText = "Google Search Engine ID"
columns = 30
}
@Suppress("unused")
@Name("Store Metadata")
val storeMetadata = JTextArea().apply {
Expand Down Expand Up @@ -268,6 +286,10 @@ class AppSettingsComponent : com.intellij.openapi.Disposable {
}

init {
// Initialize new fields
githubToken.text = AppSettingsState.instance.githubToken ?: ""
googleApiKey.text = AppSettingsState.instance.googleApiKey ?: ""
googleSearchEngineId.text = AppSettingsState.instance.googleSearchEngineId ?: ""
// Initialize executables list
setExecutables(AppSettingsState.instance.executables)
fun getExecutables(): Set<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ data class AppSettingsState(
var executables: MutableSet<String> = mutableSetOf(),
var recentArguments: MutableList<String> = mutableListOf(),
val recentCommands: MutableMap<String, MRUItems> = mutableMapOf<String, MRUItems>(),
var userSuppliedModels: MutableList<UserSuppliedModel> = mutableListOf()
var userSuppliedModels: MutableList<UserSuppliedModel> = mutableListOf(),
var githubToken: String? = null,
var googleApiKey: String? = null,
var googleSearchEngineId: String? = null
) : PersistentStateComponent<SimpleEnvelope> {
private var onSettingsLoadedListeners = mutableListOf<() -> Unit>()

Expand Down Expand Up @@ -122,6 +125,9 @@ data class AppSettingsState(
if (executables != other.executables) return false
//userSuppliedModels
if (userSuppliedModels.toTypedArray().contentDeepEquals(other.userSuppliedModels.toTypedArray()).not()) return false
if (googleApiKey != other.googleApiKey) return false
if (googleSearchEngineId != other.googleSearchEngineId) return false
if (githubToken != other.githubToken) return false
return true
}

Expand Down Expand Up @@ -151,16 +157,13 @@ data class AppSettingsState(
result = 31 * result + enableLegacyActions.hashCode()
result = 31 * result + executables.hashCode()
result = 31 * result + userSuppliedModels.hashCode()
result = 31 * result + (googleApiKey?.hashCode() ?: 0)
result = 31 * result + (googleSearchEngineId?.hashCode() ?: 0)
result = 31 * result + (githubToken?.hashCode() ?: 0)
return result
}

companion object {
/**
* Gets the instance of AppSettingsState for the current project.
*
* @return The AppSettingsState instance.
*/

val log = LoggerFactory.getLogger(AppSettingsState::class.java)
var auxiliaryLog: File? = null
const val WELCOME_VERSION: String = "1.5.0"
Expand All @@ -184,27 +187,5 @@ data class AppSettingsState(
var modelId: String = "",
var provider: APIProvider = APIProvider.OpenAI
)
/**
* The API key used for authentication with the AI service.
*/
/**
* The selected AI model to be used for code generation and analysis.
*/
/**
* The temperature setting for AI responses (0.0 to 1.0).
*/
/**
* The maximum number of tokens to be used in AI requests.
*/
/**
* Gets the instance of AppSettingsState.
*
* @return The current instance of AppSettingsState.
*/
/**
* Loads the state from the given state object.
*
* @param state The state object to load from.
*/
var analyticsEnabled: Boolean = false
}
Loading

0 comments on commit 5d35874

Please sign in to comment.