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'
77import { TabType } from '../storages/tabsStorage'
88import { FollowUpGenerator } from '../followUps/generator'
99import { QuickActionGenerator } from '../quickActions/generator'
1010import { TabTypeDataMap } from './constants'
1111import { agentWalkthroughDataModel } from '../walkthrough/agent'
12+ import { FeatureConfigProvider , Features } from '../../../../shared'
1213
1314export 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}
0 commit comments