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,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}
0 commit comments