@@ -12,9 +12,9 @@ import {
1212 WebviewViewResolveContext ,
1313 Uri ,
1414} from 'vscode'
15- import { LanguageServerResolver } from 'aws-core-vscode/shared'
1615import { QuickActionCommandGroup } from '@aws/mynah-ui'
1716import * as path from 'path'
17+ import { AmazonQPromptSettings , LanguageServerResolver } from 'aws-core-vscode/shared'
1818
1919export class AmazonQChatViewProvider implements WebviewViewProvider {
2020 public static readonly viewType = 'aws.amazonq.AmazonQChatView'
@@ -43,7 +43,11 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
4343
4444 constructor ( private readonly mynahUIPath : string ) { }
4545
46- public resolveWebviewView ( webviewView : WebviewView , context : WebviewViewResolveContext , _token : CancellationToken ) {
46+ public async resolveWebviewView (
47+ webviewView : WebviewView ,
48+ context : WebviewViewResolveContext ,
49+ _token : CancellationToken
50+ ) {
4751 this . webview = webviewView . webview
4852
4953 const lspDir = Uri . parse ( LanguageServerResolver . defaultDir )
@@ -54,12 +58,13 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
5458 }
5559
5660 const uiPath = webviewView . webview . asWebviewUri ( Uri . parse ( this . mynahUIPath ) ) . toString ( )
57- webviewView . webview . html = this . getWebviewContent ( uiPath )
61+ webviewView . webview . html = await this . getWebviewContent ( uiPath )
5862
5963 this . onDidResolveWebviewEmitter . fire ( )
6064 }
6165
62- private getWebviewContent ( mynahUIPath : string ) {
66+ private async getWebviewContent ( mynahUIPath : string ) {
67+ const disclaimerAcknowledged = AmazonQPromptSettings . instance . isPromptEnabled ( 'amazonQChatDisclaimer' )
6368 return `
6469 <!DOCTYPE html>
6570 <html lang="en">
@@ -84,7 +89,7 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
8489 <script type="text/javascript" src="${ mynahUIPath . toString ( ) } " defer onload="init()"></script>
8590 <script type="text/javascript">
8691 const init = () => {
87- amazonQChat.createChat(acquireVsCodeApi(), { disclaimerAcknowledged: false , quickActionCommands: ${ JSON . stringify ( this . quickActionCommands ) } });
92+ amazonQChat.createChat(acquireVsCodeApi(), { disclaimerAcknowledged: ${ disclaimerAcknowledged } , quickActionCommands: ${ JSON . stringify ( this . quickActionCommands ) } });
8893 }
8994 </script>
9095 </body>
0 commit comments