Skip to content

Commit

Permalink
fix: fix empty input issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 20, 2023
1 parent 79286b0 commit aa2846b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -81,6 +81,10 @@ class ChatCodingPanel(private val chatCodingService: ChatCodingService, val disp
override fun onSubmit(component: AutoDevInputSection, trigger: AutoDevInputTrigger) {
val prompt = component.text
component.text = ""
if (prompt.isEmpty()) {
return
}

val context = ChatContext(null, "", "")

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

suspend fun updateMessage(content: Flow<String>): String {
if (myList.componentCount > 0) {
myList.remove(myList.componentCount - 1)
myList.remove(myList.componentCount - 1)
}

progressBar.isVisible = true
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/cc/unitmesh/devti/gui/chat/MessageView.kt
Expand Up @@ -96,7 +96,7 @@ class MessageView(private val message: String, val role: ChatRole, private val d
}
blockView.initialize()
blockView.getComponent()?.setForeground(JBUI.CurrentTheme.Label.foreground())
centerPanel.add(blockView.getComponent())
blockView.getComponent()?.let { component -> centerPanel.add(component) }
}
}

Expand Down

0 comments on commit aa2846b

Please sign in to comment.