Skip to content

Commit d660430

Browse files
authored
feat(amazonq): user can View and Apply diff #5904
Allow users to View and Apply diff when they explictily send code to Amazon Q using - Fix, Refactor, Optimize and Send To Prompt. Notes: - Releasing it all customers - The View and Apply diff is only retained for first response after Fix, Refactor, Optimize and Send To Prompt, and NOT for followup chats. - `featureConfig` is the setup for A/B experiments and`Ignored` by `tslint` because, - currently View Diff and Apply Diff are the only feature that uses these. - If the changes are reverted the next time any team wants to use it, they will have to rewire the A/B experiments setup again.
1 parent 9fd91dd commit d660430

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Allow users to View and Apply diff when they explictily send code to Amazon Q using - Fix, Refactor, Optimize and Send To Prompt."
4+
}

packages/core/src/amazonq/webview/ui/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,18 @@ export const createMynahUI = (
9090
// eslint-disable-next-line prefer-const
9191
let messageController: MessageController
9292

93+
// @ts-ignore
9394
let featureConfigs: Map<string, FeatureContext> = tryNewMap(featureConfigsSerialized)
9495

9596
function shouldDisplayDiff(messageData: any) {
96-
const isEnabled = featureConfigs.get('ViewDiffInChat')?.variation === 'TREATMENT'
9797
const tab = tabsStorage.getTab(messageData?.tabID || '')
9898
const allowedCommands = [
9999
'aws.amazonq.refactorCode',
100100
'aws.amazonq.fixCode',
101101
'aws.amazonq.optimizeCode',
102102
'aws.amazonq.sendToPrompt',
103103
]
104-
if (isEnabled && tab?.type === 'cwc' && allowedCommands.includes(tab.lastCommand || '')) {
104+
if (tab?.type === 'cwc' && allowedCommands.includes(tab.lastCommand || '')) {
105105
return true
106106
}
107107
return false

packages/core/src/codewhispererChat/controllers/chat/telemetryHelper.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ export class CWCTelemetryHelper {
358358
return 'UPVOTE'
359359
case 'downvote':
360360
return 'DOWNVOTE'
361+
case 'acceptDiff':
362+
return 'ACCEPT_DIFF'
363+
case 'viewDiff':
364+
return 'VIEW_DIFF'
361365
default:
362366
return 'UNKNOWN'
363367
}

0 commit comments

Comments
 (0)