Skip to content

Commit

Permalink
fix(CustomAgentChatProcessor): handle response actions more robustly …
Browse files Browse the repository at this point in the history
…and add logging #51
  • Loading branch information
phodal committed Mar 7, 2024
1 parent f2c708b commit d49b2c0
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -54,9 +54,14 @@ class CustomAgentChatProcessor(val project: Project) {

CustomAgentResponseAction.Stream -> {
ui.addMessage(AutoDevBundle.message("autodev.loading"))
var msg = ""
LLMCoroutineScope.scope(project).launch {
ui.updateMessage(response)
msg = ui.updateMessage(response)
}

llmProvider.appendLocalMessage(msg, ChatRole.Assistant)
ui.hiddenProgressBar()
ui.updateUI()
}

CustomAgentResponseAction.TextChunk -> {
Expand All @@ -75,7 +80,7 @@ class CustomAgentChatProcessor(val project: Project) {
}

CustomAgentResponseAction.Flow -> {
TODO()
logger.error("will not support flow response for now")
}

CustomAgentResponseAction.WebView -> {
Expand All @@ -85,7 +90,7 @@ class CustomAgentChatProcessor(val project: Project) {
sb.append(it)
}
}
// TODO: add decode support

val content = sb.toString()
llmProvider.appendLocalMessage(content, ChatRole.Assistant)

Expand Down

0 comments on commit d49b2c0

Please sign in to comment.