From 3f3b7b6e2b08233ba243652ce94fa4bdf4913e16 Mon Sep 17 00:00:00 2001 From: Luo Tim Date: Tue, 18 Jun 2024 17:15:39 +0800 Subject: [PATCH 1/7] refactor: Remove list contexts and models actions - Deleted actions for listing contexts and models requests and responses - Removed handlers for list contexts and models, simplifying the code - This contributes to streamlining the core functionalities --- .../ai/devchat/core/ActionHandlerFactory.kt | 2 -- .../kotlin/ai/devchat/core/DevChatActions.kt | 4 --- .../handlers/ListContextsRequestHandler.kt | 28 ------------------- .../core/handlers/ListModelsRequestHandler.kt | 17 ----------- 4 files changed, 51 deletions(-) delete mode 100644 src/main/kotlin/ai/devchat/core/handlers/ListContextsRequestHandler.kt delete mode 100644 src/main/kotlin/ai/devchat/core/handlers/ListModelsRequestHandler.kt diff --git a/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt b/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt index 55a1aef..7c332f0 100644 --- a/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt +++ b/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt @@ -20,8 +20,6 @@ class ActionHandlerFactory { DevChatActions.NEW_SRC_FILE_REQUEST to NewSrcFile::class, DevChatActions.REPLACE_FILE_CONTENT_REQUEST to ReplaceFileContentHandler::class, DevChatActions.VIEW_DIFF_REQUEST to ViewDiffRequestHandler::class, - DevChatActions.LIST_CONTEXTS_REQUEST to ListContextsRequestHandler::class, - DevChatActions.LIST_MODELS_REQUEST to ListModelsRequestHandler::class, DevChatActions.ADD_CONTEXT_REQUEST to AddContextRequestHandler::class, DevChatActions.GET_KEY_REQUEST to GetKeyRequestHandler::class, DevChatActions.COMMIT_CODE_REQUEST to CommitCodeRequestHandler::class, diff --git a/src/main/kotlin/ai/devchat/core/DevChatActions.kt b/src/main/kotlin/ai/devchat/core/DevChatActions.kt index f1b5186..698e72b 100644 --- a/src/main/kotlin/ai/devchat/core/DevChatActions.kt +++ b/src/main/kotlin/ai/devchat/core/DevChatActions.kt @@ -33,10 +33,6 @@ object DevChatActions { const val REPLACE_FILE_CONTENT_RESPONSE = "replaceFileContent/response" const val VIEW_DIFF_REQUEST = "viewDiff/request" const val VIEW_DIFF_RESPONSE = "viewDiff/response" - const val LIST_CONTEXTS_REQUEST = "listContexts/request" - const val LIST_CONTEXTS_RESPONSE = "listContexts/response" - const val LIST_MODELS_REQUEST = "listModels/request" - const val LIST_MODELS_RESPONSE = "listModels/response" const val GET_KEY_REQUEST = "getKey/request" const val GET_KEY_RESPONSE = "getKey/response" const val COMMIT_CODE_REQUEST = "commitCode/request" diff --git a/src/main/kotlin/ai/devchat/core/handlers/ListContextsRequestHandler.kt b/src/main/kotlin/ai/devchat/core/handlers/ListContextsRequestHandler.kt deleted file mode 100644 index 70b377d..0000000 --- a/src/main/kotlin/ai/devchat/core/handlers/ListContextsRequestHandler.kt +++ /dev/null @@ -1,28 +0,0 @@ -package ai.devchat.core.handlers - -import ai.devchat.core.BaseActionHandler -import ai.devchat.core.DevChatActions -import com.alibaba.fastjson.JSONObject - - -class ListContextsRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( - requestAction, - metadata, - payload -) { - override val actionName: String = DevChatActions.LIST_CONTEXTS_RESPONSE - override fun action() { - val contexts = listOf( - mapOf( - "command" to "git diff -cached", - "description" to "the staged changes since the last commit" - ), - mapOf( - "command" to "git diff HEAD", - "description" to "all changes since the last commit" - ) - ) - send(payload=mapOf("contexts" to contexts)) - } - -} diff --git a/src/main/kotlin/ai/devchat/core/handlers/ListModelsRequestHandler.kt b/src/main/kotlin/ai/devchat/core/handlers/ListModelsRequestHandler.kt deleted file mode 100644 index b054f72..0000000 --- a/src/main/kotlin/ai/devchat/core/handlers/ListModelsRequestHandler.kt +++ /dev/null @@ -1,17 +0,0 @@ -package ai.devchat.core.handlers - -import ai.devchat.core.BaseActionHandler -import ai.devchat.core.DevChatActions -import ai.devchat.storage.CONFIG -import com.alibaba.fastjson.JSONObject - -class ListModelsRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( - requestAction, - metadata, - payload -) { - override val actionName: String = DevChatActions.LIST_MODELS_RESPONSE - override fun action() { - send(payload=mapOf("models" to ((CONFIG["models"] as? Map<*, *>)?.keys ?: listOf()))) - } -} From 0cc5a61996335f5347e382690894792723db8b71 Mon Sep 17 00:00:00 2001 From: Luo Tim Date: Wed, 19 Jun 2024 14:35:04 +0800 Subject: [PATCH 2/7] Remove ShowSettingDialog --- .../ai/devchat/core/ActionHandlerFactory.kt | 1 - .../kotlin/ai/devchat/core/DevChatActions.kt | 1 - .../ShowSettingDialogRequestHandler.kt | 19 ------------------- 3 files changed, 21 deletions(-) delete mode 100644 src/main/kotlin/ai/devchat/core/handlers/ShowSettingDialogRequestHandler.kt diff --git a/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt b/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt index 7c332f0..1df77b1 100644 --- a/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt +++ b/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt @@ -29,7 +29,6 @@ class ActionHandlerFactory { DevChatActions.GET_SERVER_SETTINGS_REQUEST to GetServerSettingsRequestHandler::class, DevChatActions.UPDATE_SERVER_SETTINGS_REQUEST to UpdateServerSettingsRequestHandler::class, DevChatActions.INPUT_REQUEST to InputRequestHandler::class, - DevChatActions.SHOW_SETTING_DIALOG_REQUEST to ShowSettingDialogRequestHandler::class, DevChatActions.DELETE_LAST_CONVERSATION_REQUEST to DeleteLastConversationRequestHandler::class, DevChatActions.DELETE_TOPIC_REQUEST to DeleteTopicRequestHandler::class, DevChatActions.STOP_GENERATION_REQUEST to StopGenerationRequestHandler::class, diff --git a/src/main/kotlin/ai/devchat/core/DevChatActions.kt b/src/main/kotlin/ai/devchat/core/DevChatActions.kt index 698e72b..5ba387c 100644 --- a/src/main/kotlin/ai/devchat/core/DevChatActions.kt +++ b/src/main/kotlin/ai/devchat/core/DevChatActions.kt @@ -51,7 +51,6 @@ object DevChatActions { const val INPUT_RESPONSE = "input/response" const val STOP_GENERATION_REQUEST = "stopGeneration/request" const val STOP_GENERATION_RESPONSE = "stopGeneration/request" - const val SHOW_SETTING_DIALOG_REQUEST = "showSettingDialog/request" const val DELETE_LAST_CONVERSATION_REQUEST = "deleteLastConversation/request" const val DELETE_LAST_CONVERSATION_RESPONSE = "deleteLastConversation/response" const val DELETE_TOPIC_REQUEST = "deleteTopic/request" diff --git a/src/main/kotlin/ai/devchat/core/handlers/ShowSettingDialogRequestHandler.kt b/src/main/kotlin/ai/devchat/core/handlers/ShowSettingDialogRequestHandler.kt deleted file mode 100644 index 18a98c7..0000000 --- a/src/main/kotlin/ai/devchat/core/handlers/ShowSettingDialogRequestHandler.kt +++ /dev/null @@ -1,19 +0,0 @@ -package ai.devchat.core.handlers - -import ai.devchat.core.BaseActionHandler -import ai.devchat.core.DevChatActions -import ai.devchat.plugin.currentProject -import com.alibaba.fastjson.JSONObject -import com.intellij.openapi.options.ShowSettingsUtil - - -class ShowSettingDialogRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( - requestAction, - metadata, - payload -) { - override val actionName: String = DevChatActions.SHOW_SETTING_DIALOG_REQUEST - override fun action() { - ShowSettingsUtil.getInstance().showSettingsDialog(currentProject, "DevChat") - } -} From 916d7a3d200d0c38311facea16cd2cac2c8789e8 Mon Sep 17 00:00:00 2001 From: Luo Tim Date: Wed, 19 Jun 2024 14:35:14 +0800 Subject: [PATCH 3/7] Update GUI --- gui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui b/gui index e5c71c7..88e3673 160000 --- a/gui +++ b/gui @@ -1 +1 @@ -Subproject commit e5c71c777c99b3fc1c2a580ddab7d711decb01c1 +Subproject commit 88e3673aefae867ccf23633aa7e01b64afdd979c From 445284c00644f6071ecf179d0056dfcf62145cca Mon Sep 17 00:00:00 2001 From: Luo Tim Date: Wed, 19 Jun 2024 16:15:09 +0800 Subject: [PATCH 4/7] refactor: Remove obsolete action handlers and requests - Deleted handlers and requests for SET_OR_UPDATE_KEY, ADD_CONTEXT, GET_KEY, and UPDATE_LANGUAGE. - Removed associated constants from DevChatActions. - This cleanup reduces clutter and potential confusion in the action handling infrastructure. --- .../ai/devchat/core/ActionHandlerFactory.kt | 4 -- .../kotlin/ai/devchat/core/DevChatActions.kt | 8 ---- .../core/handlers/AddContextRequestHandler.kt | 37 ------------------- .../core/handlers/GetKeyRequestHandler.kt | 21 ----------- .../handlers/SetOrUpdateKeyRequestHandler.kt | 22 ----------- .../handlers/UpdateLanguageRequestHandler.kt | 23 ------------ 6 files changed, 115 deletions(-) delete mode 100644 src/main/kotlin/ai/devchat/core/handlers/AddContextRequestHandler.kt delete mode 100644 src/main/kotlin/ai/devchat/core/handlers/GetKeyRequestHandler.kt delete mode 100644 src/main/kotlin/ai/devchat/core/handlers/SetOrUpdateKeyRequestHandler.kt delete mode 100644 src/main/kotlin/ai/devchat/core/handlers/UpdateLanguageRequestHandler.kt diff --git a/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt b/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt index 1df77b1..04024de 100644 --- a/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt +++ b/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt @@ -9,19 +9,15 @@ class ActionHandlerFactory { private val actionHandlerMap: Map> = mapOf( DevChatActions.SEND_MESSAGE_REQUEST to SendMessageRequestHandler::class, DevChatActions.REGENERATION_REQUEST to SendMessageRequestHandler::class, - DevChatActions.SET_OR_UPDATE_KEY_REQUEST to SetOrUpdateKeyRequestHandler::class, DevChatActions.LIST_COMMANDS_REQUEST to ListCommandsRequestHandler::class, DevChatActions.LOAD_CONVERSATIONS_REQUEST to LoadConversationRequestHandler::class, DevChatActions.LOAD_HISTORY_MESSAGES_REQUEST to LoadHistoryMessagesRequestHandler::class, - DevChatActions.UPDATE_LANGUAGE_REQUEST to UpdateLanguageRequestHandler::class, DevChatActions.OPEN_LINK_REQUEST to OpenLinkRequestHandler::class, DevChatActions.LIST_TOPICS_REQUEST to ListTopicsRequestHandler::class, DevChatActions.INSERT_CODE_REQUEST to InsertCodeRequestHandler::class, DevChatActions.NEW_SRC_FILE_REQUEST to NewSrcFile::class, DevChatActions.REPLACE_FILE_CONTENT_REQUEST to ReplaceFileContentHandler::class, DevChatActions.VIEW_DIFF_REQUEST to ViewDiffRequestHandler::class, - DevChatActions.ADD_CONTEXT_REQUEST to AddContextRequestHandler::class, - DevChatActions.GET_KEY_REQUEST to GetKeyRequestHandler::class, DevChatActions.COMMIT_CODE_REQUEST to CommitCodeRequestHandler::class, DevChatActions.GET_IDE_SERVICE_PORT_REQUEST to GetIDEServicePortRequestHandler::class, DevChatActions.GET_SETTING_REQUEST to GetSettingRequestHandler::class, diff --git a/src/main/kotlin/ai/devchat/core/DevChatActions.kt b/src/main/kotlin/ai/devchat/core/DevChatActions.kt index 5ba387c..2eebd3c 100644 --- a/src/main/kotlin/ai/devchat/core/DevChatActions.kt +++ b/src/main/kotlin/ai/devchat/core/DevChatActions.kt @@ -8,10 +8,6 @@ object DevChatActions { const val SEND_USER_MESSAGE_RESPONSE = "sendUserMessage/response" const val CODE_DIFF_APPLY_REQUEST = "codeDiffApply/request" const val CODE_DIFF_APPLY_RESPONSE = "codeDiffApply/response" - const val SET_OR_UPDATE_KEY_REQUEST = "setOrUpdateKey/request" - const val SET_OR_UPDATE_KEY_RESPONSE = "setOrUpdateKey/response" - const val ADD_CONTEXT_REQUEST = "addContext/request" - const val ADD_CONTEXT_RESPONSE = "addContext/response" const val ADD_CONTEXT_NOTIFY = "addContext/notify" const val LIST_COMMANDS_REQUEST = "listCommands/request" const val LIST_COMMANDS_RESPONSE = "listCommands/response" @@ -19,8 +15,6 @@ object DevChatActions { const val LOAD_CONVERSATIONS_RESPONSE = "loadConversations/response" const val LOAD_HISTORY_MESSAGES_REQUEST = "loadHistoryMessages/request" const val LOAD_HISTORY_MESSAGES_RESPONSE = "loadHistoryMessages/response" - const val UPDATE_LANGUAGE_REQUEST = "updateLanguage/request" - const val UPDATE_LANGUAGE_RESPONSE = "updateLanguage/response" const val OPEN_LINK_REQUEST = "openLink/request" const val OPEN_LINK_RESPONSE = "openLink/response" const val LIST_TOPICS_REQUEST = "listTopics/request" @@ -33,8 +27,6 @@ object DevChatActions { const val REPLACE_FILE_CONTENT_RESPONSE = "replaceFileContent/response" const val VIEW_DIFF_REQUEST = "viewDiff/request" const val VIEW_DIFF_RESPONSE = "viewDiff/response" - const val GET_KEY_REQUEST = "getKey/request" - const val GET_KEY_RESPONSE = "getKey/response" const val COMMIT_CODE_REQUEST = "commitCode/request" const val COMMIT_CODE_RESPONSE = "commitCode/response" const val GET_IDE_SERVICE_PORT_REQUEST = "getIDEServicePort/request" diff --git a/src/main/kotlin/ai/devchat/core/handlers/AddContextRequestHandler.kt b/src/main/kotlin/ai/devchat/core/handlers/AddContextRequestHandler.kt deleted file mode 100644 index f443fa0..0000000 --- a/src/main/kotlin/ai/devchat/core/handlers/AddContextRequestHandler.kt +++ /dev/null @@ -1,37 +0,0 @@ -package ai.devchat.core.handlers - -import ai.devchat.core.BaseActionHandler -import ai.devchat.core.DevChatActions -import ai.devchat.plugin.currentProject -import com.alibaba.fastjson.JSONObject -import java.io.BufferedReader -import java.io.File - -class AddContextRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( - requestAction, - metadata, - payload -) { - override val actionName: String = DevChatActions.ADD_CONTEXT_RESPONSE - val command: String? = payload?.getString("command") - - override fun action() { - val projectDir = currentProject?.basePath - val process = Runtime.getRuntime().exec(command, null, projectDir?.let { File(it) }) - val result = process.inputStream.bufferedReader().use(BufferedReader::readText) - val errors = process.errorStream.bufferedReader().use(BufferedReader::readText) - process.waitFor() - val exitCode = process.exitValue() - if (exitCode != 0) { - throw RuntimeException("Failed to execute command: $command, Exit Code: $exitCode Error: $errors") - } - send(payload=mapOf("command" to command, "content" to result)) - } - - override fun except(exception: Exception) { - send( - metadata=mapOf("status" to "error", "error" to exception.message), - payload=mapOf("command" to command, "content" to "") - ) - } -} diff --git a/src/main/kotlin/ai/devchat/core/handlers/GetKeyRequestHandler.kt b/src/main/kotlin/ai/devchat/core/handlers/GetKeyRequestHandler.kt deleted file mode 100644 index ae8dd63..0000000 --- a/src/main/kotlin/ai/devchat/core/handlers/GetKeyRequestHandler.kt +++ /dev/null @@ -1,21 +0,0 @@ -package ai.devchat.core.handlers - -import ai.devchat.core.BaseActionHandler -import ai.devchat.core.DevChatActions -import ai.devchat.storage.SensitiveDataStorage -import com.alibaba.fastjson.JSONObject - -class GetKeyRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( - requestAction, - metadata, - payload -) { - override val actionName: String = DevChatActions.GET_KEY_RESPONSE - override fun executeAction() { - val key = SensitiveDataStorage.key - if (key.isNullOrEmpty()) { - throw RuntimeException("key is empty") - } - send(payload = mapOf("key" to key)) - } -} diff --git a/src/main/kotlin/ai/devchat/core/handlers/SetOrUpdateKeyRequestHandler.kt b/src/main/kotlin/ai/devchat/core/handlers/SetOrUpdateKeyRequestHandler.kt deleted file mode 100644 index acbd190..0000000 --- a/src/main/kotlin/ai/devchat/core/handlers/SetOrUpdateKeyRequestHandler.kt +++ /dev/null @@ -1,22 +0,0 @@ -package ai.devchat.core.handlers - -import ai.devchat.core.BaseActionHandler -import ai.devchat.core.DevChatActions -import ai.devchat.storage.SensitiveDataStorage -import com.alibaba.fastjson.JSONObject - -class SetOrUpdateKeyRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( - requestAction, - metadata, - payload -) { - override val actionName: String = DevChatActions.SET_OR_UPDATE_KEY_RESPONSE - override fun executeAction() { - val key = payload!!.getString("key") - if (key == null || key.isEmpty()) { - throw RuntimeException("key is empty") - } - SensitiveDataStorage.key = key - send() - } -} diff --git a/src/main/kotlin/ai/devchat/core/handlers/UpdateLanguageRequestHandler.kt b/src/main/kotlin/ai/devchat/core/handlers/UpdateLanguageRequestHandler.kt deleted file mode 100644 index 91e03da..0000000 --- a/src/main/kotlin/ai/devchat/core/handlers/UpdateLanguageRequestHandler.kt +++ /dev/null @@ -1,23 +0,0 @@ -package ai.devchat.core.handlers - -import ai.devchat.core.BaseActionHandler -import ai.devchat.core.DevChatActions -import ai.devchat.storage.CONFIG -import com.alibaba.fastjson.JSONObject - -class UpdateLanguageRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( - requestAction, - metadata, - payload -) { - override val actionName: String = DevChatActions.UPDATE_LANGUAGE_RESPONSE - - override fun action() { - payload!!.getString("language")?.let { - it.takeIf { it.isNotEmpty() }?.let { - CONFIG["language"] = if (it == "zh") "zh" else "en" - } - } - send() - } -} From 9501d13317c7d35e97e8ce0ff5c8c8b75ed32a64 Mon Sep 17 00:00:00 2001 From: Luo Tim Date: Wed, 19 Jun 2024 16:43:20 +0800 Subject: [PATCH 5/7] Remove CommitCode --- .../ai/devchat/core/ActionHandlerFactory.kt | 1 - .../kotlin/ai/devchat/core/DevChatActions.kt | 2 -- .../core/handlers/CommitCodeRequestHandler.kt | 33 ------------------- 3 files changed, 36 deletions(-) delete mode 100644 src/main/kotlin/ai/devchat/core/handlers/CommitCodeRequestHandler.kt diff --git a/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt b/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt index 04024de..65e7e12 100644 --- a/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt +++ b/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt @@ -18,7 +18,6 @@ class ActionHandlerFactory { DevChatActions.NEW_SRC_FILE_REQUEST to NewSrcFile::class, DevChatActions.REPLACE_FILE_CONTENT_REQUEST to ReplaceFileContentHandler::class, DevChatActions.VIEW_DIFF_REQUEST to ViewDiffRequestHandler::class, - DevChatActions.COMMIT_CODE_REQUEST to CommitCodeRequestHandler::class, DevChatActions.GET_IDE_SERVICE_PORT_REQUEST to GetIDEServicePortRequestHandler::class, DevChatActions.GET_SETTING_REQUEST to GetSettingRequestHandler::class, DevChatActions.UPDATE_SETTING_REQUEST to UpdateSettingRequestHandler::class, diff --git a/src/main/kotlin/ai/devchat/core/DevChatActions.kt b/src/main/kotlin/ai/devchat/core/DevChatActions.kt index 2eebd3c..0781862 100644 --- a/src/main/kotlin/ai/devchat/core/DevChatActions.kt +++ b/src/main/kotlin/ai/devchat/core/DevChatActions.kt @@ -27,8 +27,6 @@ object DevChatActions { const val REPLACE_FILE_CONTENT_RESPONSE = "replaceFileContent/response" const val VIEW_DIFF_REQUEST = "viewDiff/request" const val VIEW_DIFF_RESPONSE = "viewDiff/response" - const val COMMIT_CODE_REQUEST = "commitCode/request" - const val COMMIT_CODE_RESPONSE = "commitCode/response" const val GET_IDE_SERVICE_PORT_REQUEST = "getIDEServicePort/request" const val GET_IDE_SERVICE_PORT_RESPONSE = "getIDEServicePort/response" const val GET_SETTING_REQUEST = "getSetting/request" diff --git a/src/main/kotlin/ai/devchat/core/handlers/CommitCodeRequestHandler.kt b/src/main/kotlin/ai/devchat/core/handlers/CommitCodeRequestHandler.kt deleted file mode 100644 index 69d98ac..0000000 --- a/src/main/kotlin/ai/devchat/core/handlers/CommitCodeRequestHandler.kt +++ /dev/null @@ -1,33 +0,0 @@ -package ai.devchat.core.handlers - -import ai.devchat.common.Log -import ai.devchat.core.BaseActionHandler -import ai.devchat.core.DevChatActions -import ai.devchat.plugin.currentProject -import com.alibaba.fastjson.JSONObject -import java.io.BufferedReader -import java.io.File - -class CommitCodeRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( - requestAction, - metadata, - payload -) { - override val actionName: String = DevChatActions.COMMIT_CODE_RESPONSE - - override fun action() { - val message = payload!!.getString("message") - val command = arrayOf("git", "commit", "-m", message) - val projectDir = currentProject?.basePath - val process = Runtime.getRuntime().exec(command, null, projectDir?.let { File(it) }) - val result = process.inputStream.bufferedReader().use(BufferedReader::readText) - val errors = process.errorStream.bufferedReader().use(BufferedReader::readText) - process.waitFor() - val exitCode = process.exitValue() - if (exitCode != 0) { - throw RuntimeException("Failed to execute command: $command, Exit Code: $exitCode Error: $errors") - } - Log.info(result) - super.action() - } -} \ No newline at end of file From 9acd261ba04d5e8c75a4af1f07b771785de6cc28 Mon Sep 17 00:00:00 2001 From: Luo Tim Date: Thu, 20 Jun 2024 08:46:17 +0800 Subject: [PATCH 6/7] Remove python for command --- src/main/kotlin/ai/devchat/core/DevChatWrapper.kt | 3 --- src/main/kotlin/ai/devchat/storage/DevChatConfig.kt | 1 - 2 files changed, 4 deletions(-) diff --git a/src/main/kotlin/ai/devchat/core/DevChatWrapper.kt b/src/main/kotlin/ai/devchat/core/DevChatWrapper.kt index f81f55e..75e5fef 100644 --- a/src/main/kotlin/ai/devchat/core/DevChatWrapper.kt +++ b/src/main/kotlin/ai/devchat/core/DevChatWrapper.kt @@ -232,9 +232,6 @@ class DevChatWrapper( env["OPENAI_API_KEY"] = it } env["PYTHONPATH"] = PathUtils.pythonPath - (CONFIG["python_for_commands"] as? String)?.let { - env["command_python"] = it - } env["DEVCHAT_IDE_SERVICE_URL"] = "http://localhost:${ideServerPort}" env["DEVCHAT_IDE_SERVICE_PORT"] = ideServerPort.toString() env["PYTHONUTF8"] = "1" diff --git a/src/main/kotlin/ai/devchat/storage/DevChatConfig.kt b/src/main/kotlin/ai/devchat/storage/DevChatConfig.kt index 77f141a..655ef6f 100644 --- a/src/main/kotlin/ai/devchat/storage/DevChatConfig.kt +++ b/src/main/kotlin/ai/devchat/storage/DevChatConfig.kt @@ -42,7 +42,6 @@ class DevChatConfig( "max_log_count" to oldSettings.maxLogCount, "language" to oldSettings.language, "python_for_chat" to oldSettings.pythonForChat, - "python_for_commands" to oldSettings.pythonForCommands, "models" to supportedModels.associateBy({it}, { defaultModelConfig }) ).forEach { (key, value) -> if (this[key] == null) { From 4ddbd0816e572fd8ef80d89d32f365a5e84d1e9a Mon Sep 17 00:00:00 2001 From: Luo Tim Date: Thu, 20 Jun 2024 08:48:33 +0800 Subject: [PATCH 7/7] Update GUI --- gui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui b/gui index 88e3673..758ae71 160000 --- a/gui +++ b/gui @@ -1 +1 @@ -Subproject commit 88e3673aefae867ccf23633aa7e01b64afdd979c +Subproject commit 758ae71aeb0e2d13690cb281c2ea8336d41aafb6