@@ -13,6 +13,7 @@ import {
1313 Uri ,
1414} from 'vscode'
1515import { LanguageServerResolver } from 'aws-core-vscode/shared'
16+ import { QuickActionCommandGroup } from '@aws/mynah-ui'
1617
1718export class AmazonQChatViewProvider implements WebviewViewProvider {
1819 public static readonly viewType = 'aws.amazonq.AmazonQChatView'
@@ -21,6 +22,24 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
2122
2223 webview : Webview | undefined
2324
25+ private readonly quickActionCommands : QuickActionCommandGroup [ ] = [
26+ {
27+ groupName : 'Quick Actions' ,
28+ commands : [
29+ {
30+ command : '/help' ,
31+ icon : 'help' ,
32+ description : 'Learn more about Amazon Q' ,
33+ } ,
34+ {
35+ command : '/clear' ,
36+ icon : 'trash' ,
37+ description : 'Clear this session' ,
38+ } ,
39+ ] ,
40+ } ,
41+ ]
42+
2443 constructor ( private readonly mynahUIPath : string ) { }
2544
2645 public resolveWebviewView ( webviewView : WebviewView , context : WebviewViewResolveContext , _token : CancellationToken ) {
@@ -34,40 +53,40 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
3453 }
3554
3655 const uiPath = webviewView . webview . asWebviewUri ( Uri . parse ( this . mynahUIPath ) ) . toString ( )
37- webviewView . webview . html = getWebviewContent ( uiPath )
56+ webviewView . webview . html = this . getWebviewContent ( uiPath )
3857
3958 this . onDidResolveWebviewEmitter . fire ( )
4059 }
41- }
4260
43- function getWebviewContent ( mynahUIPath : string ) {
44- return `
45- <!DOCTYPE html>
46- <html lang="en">
47- <head>
48- <meta charset="UTF-8">
49- <meta name="viewport" content="width=device-width, initial-scale=1.0">
50- <title>Chat</title>
51- <style>
52- body,
53- html {
54- background-color: var(--mynah-color-bg);
55- color: var(--mynah-color-text-default);
56- height: 100%;
57- width: 100%;
58- overflow: hidden;
59- margin: 0;
60- padding: 0;
61- }
62- </style>
63- </head>
64- <body>
65- <script type="text/javascript" src="${ mynahUIPath . toString ( ) } " defer onload="init()"></script>
66- <script type="text/javascript">
67- const init = () => {
68- amazonQChat.createChat(acquireVsCodeApi(), {disclaimerAcknowledged: false});
69- }
70- </script>
71- </body>
72- </html>`
61+ private getWebviewContent ( mynahUIPath : string ) {
62+ return `
63+ <!DOCTYPE html>
64+ <html lang="en">
65+ <head>
66+ <meta charset="UTF-8">
67+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
68+ <title>Chat</title>
69+ <style>
70+ body,
71+ html {
72+ background-color: var(--mynah-color-bg);
73+ color: var(--mynah-color-text-default);
74+ height: 100%;
75+ width: 100%;
76+ overflow: hidden;
77+ margin: 0;
78+ padding: 0;
79+ }
80+ </style>
81+ </head>
82+ <body>
83+ <script type="text/javascript" src="${ mynahUIPath . toString ( ) } " defer onload="init()"></script>
84+ <script type="text/javascript">
85+ const init = () => {
86+ amazonQChat.createChat(acquireVsCodeApi(), { disclaimerAcknowledged: false, quickActionCommands: ${ JSON . stringify ( this . quickActionCommands ) } });
87+ }
88+ </script>
89+ </body>
90+ </html>`
91+ }
7392}
0 commit comments