Skip to content

Commit 9d037cf

Browse files
committed
Partial chat results
1 parent fe7738d commit 9d037cf

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindow.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ class AmazonQToolWindow private constructor(
6161
AsyncChatUiListener.TOPIC,
6262
object : AsyncChatUiListener {
6363
override fun onChange(message: String) {
64-
chatPanel.browser?.postChat(message)
64+
runInEdt {
65+
chatPanel.browser?.postChat(message)
66+
}
6567
}
6668
}
6769
)

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/BrowserConnector.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,19 @@ class BrowserConnector(
166166
)
167167
)
168168
)
169+
170+
val partialResultToken = chatCommunicationManager.addPartialChatMessage(requestFromUi.params.tabId)
169171
val chatParams = ChatParams(
170172
requestFromUi.params.tabId,
171173
chatPrompt,
172174
textDocumentIdentifier,
173175
cursorState
174-
)
175-
val partialResultToken = chatCommunicationManager.addPartialChatMessage(requestFromUi.params.tabId)
176+
)
176177

177178
var encryptionManager: JwtEncryptionManager? = null
178179
val result = AmazonQLspService.executeIfRunning(project) { server ->
179180
encryptionManager = this.encryptionManager
180-
server.sendChatPrompt(EncryptedChatParams(encryptionManager!!.encrypt(chatParams)))
181+
server.sendChatPrompt(EncryptedChatParams(encryptionManager!!.encrypt(chatParams), partialResultToken))
181182
} ?: (CompletableFuture.failedFuture(IllegalStateException("LSP Server not running")))
182183

183184
result.whenComplete {

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,8 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
102102
val chatCommunicationManager = ChatCommunicationManager.getInstance(project)
103103
try {
104104
chatCommunicationManager.handlePartialResultProgressNotification(project, params)
105-
notifyInfo("hello")
106105
} catch (e: Exception) {
107-
error("cannot handle partial chat")
106+
error("Cannot handle partial chat")
108107
}
109108
}
110109
}

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/model/aws/chat/SendChatPrompt.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ data class ChatParams(
99
val tabId: String,
1010
val prompt: ChatPrompt,
1111
val textDocument: TextDocumentIdentifier,
12-
val cursorState: CursorState,
12+
val cursorState: CursorState
1313
)
1414

1515
data class EncryptedChatParams(

0 commit comments

Comments
 (0)