Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.intellij.ui.dsl.builder.Align
import com.intellij.ui.dsl.builder.panel
import com.intellij.ui.jcef.JBCefJSQuery
import org.cef.CefApp
import software.aws.toolkits.core.utils.debug
import software.aws.toolkits.core.utils.error
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.warn
Expand Down Expand Up @@ -278,6 +279,10 @@ class QWebviewBrowser(val project: Project, private val parentDisposable: Dispos
if (stage == "PROFILE_SELECT") {
try {
profiles = QRegionProfileManager.getInstance().listRegionProfiles(project).orEmpty()
if (profiles.size == 1) {
LOG.debug { "User only have access to 1 Q profile, auto-selecting profile ${profiles.first().profileName} for ${project.name}" }
QRegionProfileManager.getInstance().switchProfile(project, profiles.first(), QProfileSwitchIntent.Update)
}
} catch (e: Exception) {
errorMessage = e.message
LOG.warn { "Failed to call listRegionProfiles API" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class AmazonQToolWindowFactory : ToolWindowFactory, DumbAware {
override fun onProfileSelected(project: Project, profile: QRegionProfile?) {
if (project.isDisposed) return
AmazonQToolWindow.getInstance(project).disposeAndRecreate()
prepareChatContent(project, qPanel)
qPanel.setContent(AmazonQToolWindow.getInstance(project).component)
}
}
)
Expand Down
Loading