Skip to content

Commit aa2846b

Browse files
committed
fix: fix empty input issue
1 parent 79286b0 commit aa2846b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ class ChatCodingPanel(private val chatCodingService: ChatCodingService, val disp
8181
override fun onSubmit(component: AutoDevInputSection, trigger: AutoDevInputTrigger) {
8282
val prompt = component.text
8383
component.text = ""
84+
if (prompt.isEmpty()) {
85+
return
86+
}
87+
8488
val context = ChatContext(null, "", "")
8589

8690
chatCodingService.actionType = ChatActionType.CHAT
@@ -153,7 +157,7 @@ class ChatCodingPanel(private val chatCodingService: ChatCodingService, val disp
153157

154158
suspend fun updateMessage(content: Flow<String>): String {
155159
if (myList.componentCount > 0) {
156-
myList.remove(myList.componentCount - 1)
160+
myList.remove(myList.componentCount - 1)
157161
}
158162

159163
progressBar.isVisible = true

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class MessageView(private val message: String, val role: ChatRole, private val d
9696
}
9797
blockView.initialize()
9898
blockView.getComponent()?.setForeground(JBUI.CurrentTheme.Label.foreground())
99-
centerPanel.add(blockView.getComponent())
99+
blockView.getComponent()?.let { component -> centerPanel.add(component) }
100100
}
101101
}
102102

0 commit comments

Comments
 (0)