@@ -25,6 +25,7 @@ import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.CHAT_
2525import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.ErrorParams
2626import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.GetSerializedChatResult
2727import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.SEND_CHAT_COMMAND_PROMPT
28+ import software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfileDialog
2829import software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfileManager
2930import software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfileSelectedListener
3031import java.util.UUID
@@ -140,19 +141,30 @@ class ChatCommunicationManager(private val cs: CoroutineScope) {
140141 val incomingType = params.authFollowupType
141142 val connectionManager = ToolkitConnectionManager .getInstance(project)
142143 try {
143- connectionManager.activeConnectionForFeature(QConnection .getInstance())?.let {
144- reauthConnectionIfNeeded(project, it, isReAuth = true )
145- }
144+
146145 when (incomingType) {
147146 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+
150159 return
151160 }
152161 AuthFollowupType .RE_AUTH ,
153162 AuthFollowupType .MISSING_SCOPES ,
154163 AuthFollowupType .FULL_AUTH ,
155164 -> {
165+ connectionManager.activeConnectionForFeature(QConnection .getInstance())?.let {
166+ reauthConnectionIfNeeded(project, it, isReAuth = true )
167+ }
156168 return
157169 }
158170 else -> {
0 commit comments