@@ -24,6 +24,7 @@ import {
2424import { AuthUtil , RegionProfile } from 'aws-core-vscode/codewhisperer'
2525import { featureConfig } from 'aws-core-vscode/amazonq'
2626import { getAmazonQLspConfig } from '../config'
27+ import { LanguageClient } from 'vscode-languageclient'
2728
2829export class AmazonQChatViewProvider implements WebviewViewProvider {
2930 public static readonly viewType = 'aws.amazonq.AmazonQChatView'
@@ -36,7 +37,10 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
3637 connectorAdapterPath ?: string
3738 uiPath ?: string
3839
39- constructor ( private readonly mynahUIPath : string ) { }
40+ constructor (
41+ private readonly mynahUIPath : string ,
42+ private readonly languageClient : LanguageClient
43+ ) { }
4044
4145 public async resolveWebviewView (
4246 webviewView : WebviewView ,
@@ -95,6 +99,8 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
9599 const pairProgrammingAcknowledged =
96100 ! AmazonQPromptSettings . instance . isPromptEnabled ( 'amazonQChatPairProgramming' )
97101 const welcomeCount = globals . globalState . tryGet ( 'aws.amazonq.welcomeChatShowCount' , Number , 0 )
102+ const modelSelectionEnabled =
103+ this . languageClient . initializeResult ?. awsServerCapabilities ?. chatOptions ?. modelSelection ?? false
98104
99105 // only show profile card when the two conditions
100106 // 1. profile count >= 2
@@ -143,14 +149,14 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
143149 const vscodeApi = acquireVsCodeApi()
144150 const hybridChatConnector = new HybridChatAdapter(${ ( await AuthUtil . instance . getChatAuthState ( ) ) . amazonQ === 'connected' } ,${ featureConfigData } ,${ welcomeCount } ,${ disclaimerAcknowledged } ,${ regionProfileString } ,${ disabledCommands } ,${ isSMUS } ,${ isSM } ,vscodeApi.postMessage)
145151 const commands = [hybridChatConnector.initialQuickActions[0]]
146- qChat = amazonQChat.createChat(vscodeApi, {disclaimerAcknowledged: ${ disclaimerAcknowledged } , pairProgrammingAcknowledged: ${ pairProgrammingAcknowledged } , agenticMode: true, quickActionCommands: commands}, hybridChatConnector, ${ JSON . stringify ( featureConfigData ) } );
152+ qChat = amazonQChat.createChat(vscodeApi, {disclaimerAcknowledged: ${ disclaimerAcknowledged } , pairProgrammingAcknowledged: ${ pairProgrammingAcknowledged } , agenticMode: true, quickActionCommands: commands, modelSelectionEnabled: ${ modelSelectionEnabled } }, hybridChatConnector, ${ JSON . stringify ( featureConfigData ) } );
147153 }
148154 window.addEventListener('message', (event) => {
149155 /**
150156 * special handler that "simulates" reloading the webview when a profile changes.
151157 * required because chat-client relies on initializedResult from the lsp that
152158 * are only sent once
153- *
159+ *
154160 * References:
155161 * closing tabs: https://github.com/aws/mynah-ui/blob/de736b52f369ba885cd19f33ac86c6f57b4a3134/docs/USAGE.md#removing-a-tab-programmatically-
156162 * opening tabs: https://github.com/aws/aws-toolkit-vscode/blob/c22efa03e73b241564c8051c35761eb8620edb83/packages/amazonq/test/e2e/amazonq/framework/framework.ts#L98
0 commit comments