Skip to content

Commit 5199f38

Browse files
Merge pull request #7509 from dhasani23/stv2Text
fix(amazonq): update text for STV2 feature
2 parents 0ac4ae5 + 478b657 commit 5199f38

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

packages/core/src/codewhisperer/commands/startTransformByQ.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,15 @@ export async function postTransformationJob() {
677677

678678
let chatMessage = transformByQState.getJobFailureErrorChatMessage()
679679
if (transformByQState.isSucceeded()) {
680-
chatMessage = CodeWhispererConstants.jobCompletedChatMessage(transformByQState.getTargetJDKVersion() ?? '')
680+
chatMessage = CodeWhispererConstants.jobCompletedChatMessage
681681
} else if (transformByQState.isPartiallySucceeded()) {
682682
chatMessage = CodeWhispererConstants.jobPartiallyCompletedChatMessage
683683
}
684684

685+
if (transformByQState.getSourceJDKVersion() !== transformByQState.getTargetJDKVersion()) {
686+
chatMessage += CodeWhispererConstants.upgradeLibrariesMessage
687+
}
688+
685689
transformByQState.getChatControllers()?.transformationFinished.fire({
686690
message: chatMessage,
687691
tabID: ChatSessionManager.Instance.getSession().tabID,
@@ -707,19 +711,23 @@ export async function postTransformationJob() {
707711
})
708712
}
709713

714+
let notificationMessage = ''
715+
710716
if (transformByQState.isSucceeded()) {
711-
void vscode.window.showInformationMessage(
712-
CodeWhispererConstants.jobCompletedNotification(transformByQState.getTargetJDKVersion() ?? ''),
713-
{
714-
title: localizedText.ok,
715-
}
716-
)
717+
notificationMessage = CodeWhispererConstants.jobCompletedNotification
718+
if (transformByQState.getSourceJDKVersion() !== transformByQState.getTargetJDKVersion()) {
719+
notificationMessage += CodeWhispererConstants.upgradeLibrariesMessage
720+
}
721+
void vscode.window.showInformationMessage(notificationMessage, {
722+
title: localizedText.ok,
723+
})
717724
} else if (transformByQState.isPartiallySucceeded()) {
725+
notificationMessage = CodeWhispererConstants.jobPartiallyCompletedNotification
726+
if (transformByQState.getSourceJDKVersion() !== transformByQState.getTargetJDKVersion()) {
727+
notificationMessage += CodeWhispererConstants.upgradeLibrariesMessage
728+
}
718729
void vscode.window
719-
.showInformationMessage(
720-
CodeWhispererConstants.jobPartiallyCompletedNotification,
721-
CodeWhispererConstants.amazonQFeedbackText
722-
)
730+
.showInformationMessage(notificationMessage, CodeWhispererConstants.amazonQFeedbackText)
723731
.then((choice) => {
724732
if (choice === CodeWhispererConstants.amazonQFeedbackText) {
725733
void submitFeedback(

packages/core/src/codewhisperer/models/constants.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -655,15 +655,18 @@ export const enterJavaHomePlaceholder = 'Enter the path to your Java installatio
655655

656656
export const openNewTabPlaceholder = 'Open a new tab to chat with Q'
657657

658-
export const jobCompletedChatMessage = (version: string) =>
659-
`I completed your transformation. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the changes I'm proposing. If you want to upgrade additional libraries and other dependencies, run /transform with the transformed code and specify ${version} as the source and target version.`
658+
export const jobCompletedChatMessage =
659+
'I completed your transformation. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the changes I am proposing. '
660660

661-
export const jobCompletedNotification = (version: string) =>
662-
`Amazon Q transformed your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the changes. If you want to upgrade additional libraries and other dependencies, run /transform with the transformed code and specify ${version} as the source and target version.`
661+
export const jobCompletedNotification =
662+
'Amazon Q transformed your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the changes. '
663663

664-
export const jobPartiallyCompletedChatMessage = `I transformed part of your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the files I updated and the errors that prevented a complete transformation.`
664+
export const upgradeLibrariesMessage =
665+
'After successfully building in Java 17 or 21, an additional transformation is required to upgrade your libraries and dependencies. Choose the same source code version and target code version (for example, 17 to 17) to do this.'
665666

666-
export const jobPartiallyCompletedNotification = `Amazon Q transformed part of your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the files I updated and the errors that prevented a complete transformation.`
667+
export const jobPartiallyCompletedChatMessage = `I transformed part of your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the files I updated and the errors that prevented a complete transformation. `
668+
669+
export const jobPartiallyCompletedNotification = `Amazon Q transformed part of your code. You can review the diff to see my proposed changes and accept or reject them. The transformation summary has details about the files I updated and the errors that prevented a complete transformation. `
667670

668671
export const noPomXmlFoundChatMessage = `I couldn\'t find a project that I can upgrade. I couldn\'t find a pom.xml file in any of your open projects, nor could I find any embedded SQL statements. Currently, I can upgrade Java 8, 11, or 17 projects built on Maven, or Oracle SQL to PostgreSQL statements in Java projects. For more information, see the [Amazon Q documentation](${codeTransformPrereqDoc}).`
669672

@@ -730,7 +733,7 @@ export const cleanInstallErrorNotification = `Amazon Q could not run the Maven c
730733
export const enterJavaHomeChatMessage = 'Enter the path to JDK'
731734

732735
export const projectPromptChatMessage =
733-
'I can upgrade your Java project. To start the transformation, I need some information from you. Choose the project you want to upgrade and the target code version to upgrade to. Then, choose Confirm.'
736+
'I can upgrade your Java project. To start the transformation, I need some information from you. Choose the project you want to upgrade and the target code version to upgrade to. Then, choose Confirm.\n\nAfter successfully building in Java 17 or 21, an additional transformation is required to upgrade your libraries and dependencies. Choose the same source code version and target code version (for example, 17 to 17) to do this.'
734737

735738
export const windowsJavaHomeHelpChatMessage =
736739
'To find the JDK path, run the following commands in a new terminal: `cd "C:/Program Files/Java"` and then `dir`. If you see your JDK version, run `cd <version>` and then `cd` to show the path.'

0 commit comments

Comments
 (0)