Skip to content

Commit

Permalink
Merge main into feature/dev-execution
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-toolkit-automation authored Nov 15, 2024
2 parents 52bc481 + d97a09b commit 6825653
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type" : "bugfix",
"description" : "Amazon Q chat: `@workspace` command shown in all tab types"
}
11 changes: 11 additions & 0 deletions plugins/amazonq/mynah-ui/src/mynah-ui/ui/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { QuickActionCommandGroup } from "@aws/mynah-ui-chat"

type MessageCommand =
| 'chat-prompt'
Expand Down Expand Up @@ -47,3 +48,13 @@ type MessageCommand =
| 'store-code-result-message-id'

export type ExtensionMessage = Record<string, any> & { command: MessageCommand }

export const workspaceCommand: QuickActionCommandGroup = {
groupName: 'Mention code',
commands: [
{
command: '@workspace',
description: '(BETA) Reference all code in workspace.',
},
],
}
19 changes: 7 additions & 12 deletions plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { ChatItemType, MynahUIDataModel } from '@aws/mynah-ui-chat'
import { ChatItemType, MynahUIDataModel, QuickActionCommandGroup } from '@aws/mynah-ui-chat'
import { TabType } from '../storages/tabsStorage'
import { FollowUpGenerator } from '../followUps/generator'
import { QuickActionGenerator } from '../quickActions/generator'
import { workspaceCommand } from '../commands'

export interface TabDataGeneratorProps {
isFeatureDevEnabled: boolean
Expand Down Expand Up @@ -60,6 +61,10 @@ I can help you upgrade your Java 8 and 11 codebases to Java 17.
],
])

private tabContextCommand: Map<TabType, QuickActionCommandGroup[]> = new Map([
['cwc', [workspaceCommand]],
])

constructor(props: TabDataGeneratorProps) {
this.followUpsGenerator = new FollowUpGenerator()
this.quickActionsGenerator = new QuickActionGenerator({
Expand All @@ -75,17 +80,7 @@ I can help you upgrade your Java 8 and 11 codebases to Java 17.
'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/).',
quickActionCommands: this.quickActionsGenerator.generateForTab(tabType),
promptInputPlaceholder: this.tabInputPlaceholder.get(tabType),
contextCommands: [
{
groupName: 'Mention code',
commands: [
{
command: '@workspace',
description: '(BETA) Reference all code in workspace.',
},
],
},
],
contextCommands: this.tabContextCommand.get(tabType),
chatItems: needWelcomeMessages
? [
{
Expand Down

0 comments on commit 6825653

Please sign in to comment.