Skip to content

Commit 3f2b4a6

Browse files
committed
refactor(custom-agent): improve response action handling and add removeLastMessage function #51
1 parent b7d9a2f commit 3f2b4a6

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

src/main/kotlin/cc/unitmesh/devti/counit/CustomAgentChatProcessor.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
package cc.unitmesh.devti.counit
22

3-
import cc.unitmesh.devti.AutoDevBundle
43
import cc.unitmesh.devti.counit.model.CustomAgentConfig
54
import cc.unitmesh.devti.counit.model.CustomAgentState
65
import cc.unitmesh.devti.counit.model.ResponseAction
76
import cc.unitmesh.devti.gui.chat.ChatCodingPanel
87
import cc.unitmesh.devti.gui.chat.ChatContext
98
import cc.unitmesh.devti.provider.ContextPrompter
10-
import cc.unitmesh.devti.util.LLMCoroutineScope
119
import com.intellij.openapi.components.Service
1210
import com.intellij.openapi.diagnostic.logger
1311
import com.intellij.openapi.project.Project
14-
import kotlinx.coroutines.launch
1512
import kotlinx.coroutines.runBlocking
1613

1714
@Service(Service.Level.PROJECT)
@@ -45,13 +42,6 @@ class CustomAgentChatProcessor(val project: Project) {
4542
ui.updateUI()
4643
}
4744

48-
ResponseAction.Stream -> {
49-
ui.addMessage(AutoDevBundle.message("autodev.loading"))
50-
LLMCoroutineScope.scope(project).launch {
51-
// ui.updateMessage(response)
52-
}
53-
}
54-
5545
ResponseAction.TextChunk -> {
5646
val sb = StringBuilder()
5747
runBlocking {

src/main/kotlin/cc/unitmesh/devti/counit/model/AgentResponseAction.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ enum class ResponseAction {
1313
*/
1414
Direct,
1515

16-
/**
17-
* Stream response
18-
*/
19-
Stream,
20-
2116
/**
2217
* Text splitting result
2318
*/

src/main/kotlin/cc/unitmesh/devti/gui/chat/ChatCodingPanel.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ class ChatCodingPanel(private val chatCodingService: ChatCodingService, val disp
255255
progressBar.isVisible = false
256256
}
257257

258+
/**
259+
* Remove the last message from the list and update the UI.
260+
*
261+
* @return void
262+
*/
258263
fun removeLastMessage() {
259264
if (myList.componentCount > 0) {
260265
myList.remove(myList.componentCount - 1)

0 commit comments

Comments
 (0)