From 2f9d7dde392e608c4b3375475d5c6eef2a8cf7e1 Mon Sep 17 00:00:00 2001 From: Will Lo Date: Thu, 14 Nov 2024 10:43:06 -0800 Subject: [PATCH 1/2] only send implicit workspace context when indexing is fully complete --- .../jetbrains/services/cwc/controller/ChatController.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/ChatController.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/ChatController.kt index d52503a36cc..60d1d8dc043 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/ChatController.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/ChatController.kt @@ -94,6 +94,7 @@ class ChatController private constructor( private val messagePublisher: MessagePublisher = context.messagesFromAppToUi private val telemetryHelper = TelemetryHelper(context.project, chatSessionStorage) + constructor( context: AmazonQAppInitContext, ) : this( @@ -144,7 +145,11 @@ class ChatController private constructor( } else { sendOpenSettingsMessage(message.tabId) } - } else if (CodeWhispererSettings.getInstance().isProjectContextEnabled() && isInternalUser) { + } else if ( + CodeWhispererSettings.getInstance().isProjectContextEnabled() && + isInternalUser && + ProjectContextController.getInstance(project = context.project).getProjectContextIndexComplete() + ) { // if user does not have @workspace in the prompt, but user is Amazon internal // add project context by default val projectContextController = ProjectContextController.getInstance(context.project) From a3d4f52711f4f92d92e12483bb6b2486ee1a0d2a Mon Sep 17 00:00:00 2001 From: Will Lo Date: Thu, 14 Nov 2024 10:43:54 -0800 Subject: [PATCH 2/2] a --- .../jetbrains/services/cwc/controller/ChatController.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/ChatController.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/ChatController.kt index 60d1d8dc043..84ba6543ccc 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/ChatController.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/ChatController.kt @@ -148,7 +148,7 @@ class ChatController private constructor( } else if ( CodeWhispererSettings.getInstance().isProjectContextEnabled() && isInternalUser && - ProjectContextController.getInstance(project = context.project).getProjectContextIndexComplete() + ProjectContextController.getInstance(context.project).getProjectContextIndexComplete() ) { // if user does not have @workspace in the prompt, but user is Amazon internal // add project context by default