@@ -25,6 +25,7 @@ import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.CHAT_
25
25
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.ErrorParams
26
26
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.GetSerializedChatResult
27
27
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.SEND_CHAT_COMMAND_PROMPT
28
+ import software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfileDialog
28
29
import software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfileManager
29
30
import software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfileSelectedListener
30
31
import java.util.UUID
@@ -140,19 +141,30 @@ class ChatCommunicationManager(private val cs: CoroutineScope) {
140
141
val incomingType = params.authFollowupType
141
142
val connectionManager = ToolkitConnectionManager .getInstance(project)
142
143
try {
143
- connectionManager.activeConnectionForFeature(QConnection .getInstance())?.let {
144
- reauthConnectionIfNeeded(project, it, isReAuth = true )
145
- }
144
+
146
145
when (incomingType) {
147
146
AuthFollowupType .USE_SUPPORTED_AUTH -> {
148
- project.messageBus.syncPublisher(QRegionProfileSelectedListener .TOPIC )
149
- .onProfileSelected(project, QRegionProfileManager .getInstance().activeProfile(project))
147
+ val activeProfile = QRegionProfileManager .getInstance().activeProfile(project)
148
+ if (activeProfile != null ) {
149
+ project.messageBus.syncPublisher(QRegionProfileSelectedListener .TOPIC )
150
+ .onProfileSelected(project, QRegionProfileManager .getInstance().activeProfile(project))
151
+ } else {
152
+ QRegionProfileDialog (
153
+ project,
154
+ selectedProfile = null
155
+ ).show()
156
+ }
157
+
158
+
150
159
return
151
160
}
152
161
AuthFollowupType .RE_AUTH ,
153
162
AuthFollowupType .MISSING_SCOPES ,
154
163
AuthFollowupType .FULL_AUTH ,
155
164
-> {
165
+ connectionManager.activeConnectionForFeature(QConnection .getInstance())?.let {
166
+ reauthConnectionIfNeeded(project, it, isReAuth = true )
167
+ }
156
168
return
157
169
}
158
170
else -> {
0 commit comments