From 1e4e6f8b89d0ec55d373eecd6fd78a5a74bb75bf Mon Sep 17 00:00:00 2001 From: Luo Tim Date: Sun, 16 Jun 2024 23:20:35 +0800 Subject: [PATCH] Get IDE service port --- gui | 2 +- .../ai/devchat/core/ActionHandlerFactory.kt | 1 + .../kotlin/ai/devchat/core/DevChatActions.kt | 2 ++ .../GetIDEServicePortRequestHandler.kt | 19 +++++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/ai/devchat/core/handlers/GetIDEServicePortRequestHandler.kt diff --git a/gui b/gui index 69efdb7..360bd78 160000 --- a/gui +++ b/gui @@ -1 +1 @@ -Subproject commit 69efdb7017fd5e6cde31d3d26073922598850797 +Subproject commit 360bd78d55e7477cb00e2d8020e00da0e68206e4 diff --git a/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt b/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt index 7137ee4..55a1aef 100644 --- a/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt +++ b/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt @@ -25,6 +25,7 @@ class ActionHandlerFactory { 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, DevChatActions.UPDATE_SETTING_REQUEST to UpdateSettingRequestHandler::class, DevChatActions.GET_SERVER_SETTINGS_REQUEST to GetServerSettingsRequestHandler::class, diff --git a/src/main/kotlin/ai/devchat/core/DevChatActions.kt b/src/main/kotlin/ai/devchat/core/DevChatActions.kt index 3f6a700..f1b5186 100644 --- a/src/main/kotlin/ai/devchat/core/DevChatActions.kt +++ b/src/main/kotlin/ai/devchat/core/DevChatActions.kt @@ -41,6 +41,8 @@ object DevChatActions { 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" + const val GET_IDE_SERVICE_PORT_RESPONSE = "getIDEServicePort/response" const val GET_SETTING_REQUEST = "getSetting/request" const val GET_SETTING_RESPONSE = "getSetting/response" const val UPDATE_SETTING_REQUEST = "updateSetting/request" diff --git a/src/main/kotlin/ai/devchat/core/handlers/GetIDEServicePortRequestHandler.kt b/src/main/kotlin/ai/devchat/core/handlers/GetIDEServicePortRequestHandler.kt new file mode 100644 index 0000000..f53fc7d --- /dev/null +++ b/src/main/kotlin/ai/devchat/core/handlers/GetIDEServicePortRequestHandler.kt @@ -0,0 +1,19 @@ +package ai.devchat.core.handlers + +import ai.devchat.core.BaseActionHandler +import ai.devchat.core.DevChatActions +import ai.devchat.plugin.ideServerPort +import com.alibaba.fastjson.JSONObject + + + +class GetIDEServicePortRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( + requestAction, + metadata, + payload +) { + override val actionName: String = DevChatActions.GET_IDE_SERVICE_PORT_RESPONSE + override fun action() { + send(payload= mapOf("port" to ideServerPort)) + } +}