Skip to content

Commit 9f9deb2

Browse files
committed
Adds capability to send new context commands to AB groups
1 parent 914bf73 commit 9f9deb2

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-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": "Adds capability to send new context commands to AB groups"
4+
}

packages/core/src/amazonq/webview/ui/tabs/generator.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { ChatItemType, MynahUIDataModel } from '@aws/mynah-ui'
6+
import { ChatItemType, MynahUIDataModel, QuickActionCommandGroup } from '@aws/mynah-ui'
77
import { TabType } from '../storages/tabsStorage'
88
import { FollowUpGenerator } from '../followUps/generator'
99
import { QuickActionGenerator } from '../quickActions/generator'
1010
import { TabTypeDataMap } from './constants'
1111
import { agentWalkthroughDataModel } from '../walkthrough/agent'
12+
import { FeatureConfigProvider, Features } from '../../../../shared'
1213

1314
export interface TabDataGeneratorProps {
1415
isFeatureDevEnabled: boolean
@@ -50,7 +51,7 @@ export class TabDataGenerator {
5051
'Amazon Q Developer uses generative AI. You may need to verify responses. See the [AWS Responsible AI Policy](https://aws.amazon.com/machine-learning/responsible-ai/policy/).',
5152
quickActionCommands: this.quickActionsGenerator.generateForTab(tabType),
5253
promptInputPlaceholder: TabTypeDataMap[tabType].placeholder,
53-
contextCommands: TabTypeDataMap[tabType].contextCommands,
54+
contextCommands: this.getContextCommands(tabType),
5455
chatItems: needWelcomeMessages
5556
? [
5657
{
@@ -66,4 +67,36 @@ export class TabDataGenerator {
6667
}
6768
return tabData
6869
}
70+
71+
private getContextCommands(tabType: TabType): QuickActionCommandGroup[] | undefined {
72+
if (tabType === 'agentWalkthrough' || tabType === 'welcome') {
73+
return
74+
}
75+
76+
const commandHighlight = FeatureConfigProvider.getFeature(Features.highlightCommand)
77+
78+
const commandName = commandHighlight?.value.stringValue
79+
const commandDescription = commandHighlight?.variation
80+
81+
if (commandName === undefined || commandName === '') {
82+
return TabTypeDataMap[tabType].contextCommands
83+
} else {
84+
const highlightCommand: QuickActionCommandGroup = {
85+
groupName: 'Additional Commands',
86+
commands: [
87+
{
88+
command: commandName,
89+
description: commandDescription,
90+
},
91+
],
92+
}
93+
94+
const contextCommands = TabTypeDataMap[tabType].contextCommands
95+
if (contextCommands === undefined) {
96+
return [highlightCommand]
97+
} else {
98+
return [...contextCommands, highlightCommand]
99+
}
100+
}
101+
}
69102
}

packages/core/src/shared/featureConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const Features = {
3636
dataCollectionFeature: 'IDEProjectContextDataCollection',
3737
projectContextFeature: 'ProjectContextV2',
3838
test: 'testFeature',
39+
highlightCommand: 'highlightCommand',
3940
} as const
4041

4142
export type FeatureName = (typeof Features)[keyof typeof Features]

0 commit comments

Comments
 (0)