@@ -12,9 +12,10 @@ import {
12
12
WebviewViewResolveContext ,
13
13
Uri ,
14
14
} from 'vscode'
15
- import { LanguageServerResolver } from 'aws-core-vscode/shared'
16
15
import { QuickActionCommandGroup } from '@aws/mynah-ui'
17
16
import * as path from 'path'
17
+ import { LanguageServerResolver } from 'aws-core-vscode/shared'
18
+ import { disclaimer } from 'aws-core-vscode/amazonq'
18
19
19
20
export class AmazonQChatViewProvider implements WebviewViewProvider {
20
21
public static readonly viewType = 'aws.amazonq.AmazonQChatView'
@@ -43,7 +44,11 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
43
44
44
45
constructor ( private readonly mynahUIPath : string ) { }
45
46
46
- public resolveWebviewView ( webviewView : WebviewView , context : WebviewViewResolveContext , _token : CancellationToken ) {
47
+ public async resolveWebviewView (
48
+ webviewView : WebviewView ,
49
+ context : WebviewViewResolveContext ,
50
+ _token : CancellationToken
51
+ ) {
47
52
this . webview = webviewView . webview
48
53
49
54
const lspDir = Uri . parse ( LanguageServerResolver . defaultDir )
@@ -54,12 +59,13 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
54
59
}
55
60
56
61
const uiPath = webviewView . webview . asWebviewUri ( Uri . parse ( this . mynahUIPath ) ) . toString ( )
57
- webviewView . webview . html = this . getWebviewContent ( uiPath )
62
+ webviewView . webview . html = await this . getWebviewContent ( uiPath )
58
63
59
64
this . onDidResolveWebviewEmitter . fire ( )
60
65
}
61
66
62
- private getWebviewContent ( mynahUIPath : string ) {
67
+ private async getWebviewContent ( mynahUIPath : string ) {
68
+ const disclaimerAcknowledged = await disclaimer . disclaimerAcknowledged ( )
63
69
return `
64
70
<!DOCTYPE html>
65
71
<html lang="en">
@@ -84,7 +90,7 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
84
90
<script type="text/javascript" src="${ mynahUIPath . toString ( ) } " defer onload="init()"></script>
85
91
<script type="text/javascript">
86
92
const init = () => {
87
- amazonQChat.createChat(acquireVsCodeApi(), { disclaimerAcknowledged: false , quickActionCommands: ${ JSON . stringify ( this . quickActionCommands ) } });
93
+ amazonQChat.createChat(acquireVsCodeApi(), { disclaimerAcknowledged: ${ disclaimerAcknowledged } , quickActionCommands: ${ JSON . stringify ( this . quickActionCommands ) } });
88
94
}
89
95
</script>
90
96
</body>
0 commit comments