Skip to content

Commit

Permalink
feat: add fix this for issues
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Jul 11, 2023
1 parent 7f741ae commit 12f418c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
@@ -0,0 +1,9 @@
package cc.unitmesh.devti.actions.chat

import cc.unitmesh.devti.gui.chat.ChatBotActionType

class FixThisBotAction : ChatBaseAction() {
override fun getActionType(): ChatBotActionType {
return ChatBotActionType.FixIssue
}
}
Expand Up @@ -5,8 +5,6 @@ import cc.unitmesh.devti.connector.ConnectorService
import com.intellij.openapi.application.ApplicationManager
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.runBlocking
import org.apache.tools.ant.taskdefs.Execute.launch
import kotlin.coroutines.suspendCoroutine

class ChatCodingService(var actionType: ChatBotActionType) {
val action = when (actionType) {
Expand All @@ -15,6 +13,7 @@ class ChatCodingService(var actionType: ChatBotActionType) {
ChatBotActionType.REFACTOR -> "refactor"
ChatBotActionType.CODE_COMPLETE -> "complete"
ChatBotActionType.WRITE_TEST -> "write test"
ChatBotActionType.FixIssue -> "help me fix this"
}

fun getLabel(): String {
Expand Down Expand Up @@ -70,5 +69,6 @@ enum class ChatBotActionType {
EXPLAIN,
REVIEW,
CODE_COMPLETE,
WRITE_TEST
WRITE_TEST,
FixIssue
}
4 changes: 4 additions & 0 deletions src/main/kotlin/cc/unitmesh/devti/gui/chat/PromptFormatter.kt
Expand Up @@ -201,6 +201,10 @@ class BotActionPrompting(
}
}
}

ChatBotActionType.FixIssue -> {
prompt = "fix this"
}
}

return prompt
Expand Down
9 changes: 8 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Expand Up @@ -67,12 +67,19 @@
</action>

<action id="cc.unitmesh.devti.actions.chat.WriteTestAction"
class="cc.unitmesh.devti.actions.chat.WriteTestAction" text="Write test for This"
class="cc.unitmesh.devti.actions.chat.WriteTestAction" text="Write Test for This"
description="Ask Chatbot about this code">
</action>
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
</group>

<action id="cc.unitmesh.devti.actions.chat.FixThisBotAction"
class="cc.unitmesh.devti.actions.chat.FixThisBotAction" text="Fix This (AutoDev)"
description="Ask Chatbot about this code">
<add-to-group group-id="ConsoleEditorPopupMenu" anchor="first"/>
</action>


<action id="cc.unitmesh.devti.actions.chat.CodeCompleteAction"
class="cc.unitmesh.devti.actions.chat.CodeCompleteAction" text="Code Complete (AutoDev)"
description="Ask Chatbot about this code">
Expand Down

0 comments on commit 12f418c

Please sign in to comment.