@@ -13,6 +13,7 @@ import {
13
13
Uri ,
14
14
} from 'vscode'
15
15
import { LanguageServerResolver } from 'aws-core-vscode/shared'
16
+ import { QuickActionCommandGroup } from '@aws/mynah-ui'
16
17
17
18
export class AmazonQChatViewProvider implements WebviewViewProvider {
18
19
public static readonly viewType = 'aws.amazonq.AmazonQChatView'
@@ -21,6 +22,24 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
21
22
22
23
webview : Webview | undefined
23
24
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
+
24
43
constructor ( private readonly mynahUIPath : string ) { }
25
44
26
45
public resolveWebviewView ( webviewView : WebviewView , context : WebviewViewResolveContext , _token : CancellationToken ) {
@@ -34,40 +53,40 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
34
53
}
35
54
36
55
const uiPath = webviewView . webview . asWebviewUri ( Uri . parse ( this . mynahUIPath ) ) . toString ( )
37
- webviewView . webview . html = getWebviewContent ( uiPath )
56
+ webviewView . webview . html = this . getWebviewContent ( uiPath )
38
57
39
58
this . onDidResolveWebviewEmitter . fire ( )
40
59
}
41
- }
42
60
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
+ }
73
92
}
0 commit comments