Skip to content

Commit 9df141a

Browse files
committed
Adds capability to send new context commands to AB groups
1 parent 96ce5ae commit 9df141a

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-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: 31 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,32 @@ export class TabDataGenerator {
6667
}
6768
return tabData
6869
}
70+
71+
private getContextCommands(tabType: TabType): QuickActionCommandGroup[] | undefined {
72+
const commandHighlight = FeatureConfigProvider.getFeature(Features.highlightCommand)
73+
74+
const commandName = commandHighlight?.value.stringValue
75+
const commandDescription = commandHighlight?.variation
76+
77+
if (commandName === undefined || commandName === '') {
78+
return TabTypeDataMap[tabType].contextCommands
79+
} else {
80+
const highlightCommand: QuickActionCommandGroup = {
81+
groupName: 'Additional Commands',
82+
commands: [
83+
{
84+
command: commandName,
85+
description: commandDescription,
86+
},
87+
],
88+
}
89+
90+
const contextCommands = TabTypeDataMap[tabType].contextCommands
91+
if (contextCommands === undefined) {
92+
return [highlightCommand]
93+
} else {
94+
return [...contextCommands, highlightCommand]
95+
}
96+
}
97+
}
6998
}

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)