@@ -83,9 +83,17 @@ import { ChatViewPane } from './chatViewPane.js';
8383import { IViewsService } from '../../../services/views/common/viewsService.js' ;
8484import { ICommandService } from '../../../../platform/commands/common/commands.js' ;
8585import { IHoverService } from '../../../../platform/hover/browser/hover.js' ;
86+ import product from '../../../../platform/product/common/product.js' ;
87+ import { ChatEntitlement , IChatEntitlementService } from '../../../services/chat/common/chatEntitlementService.js' ;
8688
8789const $ = dom . $ ;
8890
91+ const defaultChat = {
92+ provider : product . defaultChatAgent ?. provider ?? { default : { id : '' , name : '' } , enterprise : { id : '' , name : '' } , apple : { id : '' , name : '' } , google : { id : '' , name : '' } } ,
93+ termsStatementUrl : product . defaultChatAgent ?. termsStatementUrl ?? '' ,
94+ privacyStatementUrl : product . defaultChatAgent ?. privacyStatementUrl ?? ''
95+ } ;
96+
8997export interface IChatViewState {
9098 inputValue ?: string ;
9199 inputState ?: IChatInputState ;
@@ -421,7 +429,8 @@ export class ChatWidget extends Disposable implements IChatWidget {
421429 @IChatModeService private readonly chatModeService : IChatModeService ,
422430 @IHoverService private readonly hoverService : IHoverService ,
423431 @IChatTodoListService private readonly chatTodoListService : IChatTodoListService ,
424- @IChatLayoutService private readonly chatLayoutService : IChatLayoutService
432+ @IChatLayoutService private readonly chatLayoutService : IChatLayoutService ,
433+ @IChatEntitlementService private readonly chatEntitlementService : IChatEntitlementService ,
425434 ) {
426435 super ( ) ;
427436 this . _lockedToCodingAgentContextKey = ChatContextKeys . lockedToCodingAgent . bindTo ( this . contextKeyService ) ;
@@ -452,6 +461,16 @@ export class ChatWidget extends Disposable implements IChatWidget {
452461 } ) ) ;
453462 this . updateEmptyStateWithHistoryContext ( ) ;
454463
464+ // Update welcome view content when `anonymous` entitlement changes
465+ let anonymousUsage = this . chatEntitlementService . entitlement === ChatEntitlement . Unknown ;
466+ this . _register ( this . chatEntitlementService . onDidChangeEntitlement ( ( ) => {
467+ const newAnonymousUsage = this . chatEntitlementService . entitlement === ChatEntitlement . Unknown ;
468+ if ( newAnonymousUsage !== anonymousUsage ) {
469+ anonymousUsage = newAnonymousUsage ;
470+ this . renderWelcomeViewContentIfNeeded ( ) ;
471+ }
472+ } ) ) ;
473+
455474 this . _register ( bindContextKey ( decidedChatEditingResourceContextKey , contextKeyService , ( reader ) => {
456475 const currentSession = this . _editingSession . read ( reader ) ;
457476 if ( ! currentSession ) {
@@ -609,8 +628,8 @@ export class ChatWidget extends Disposable implements IChatWidget {
609628 ChatContextKeys . Entitlement . canSignUp . key
610629 ] ) ) ) {
611630 // reset the input in welcome view if it was rendered in experimental mode
612- if ( this . container . classList . contains ( 'experimental -welcome-view' ) && ! this . contextKeyService . contextMatchesRules ( this . chatSetupTriggerContext ) ) {
613- this . container . classList . remove ( 'experimental -welcome-view' ) ;
631+ if ( this . container . classList . contains ( 'new -welcome-view' ) && ! this . contextKeyService . contextMatchesRules ( this . chatSetupTriggerContext ) ) {
632+ this . container . classList . remove ( 'new -welcome-view' ) ;
614633 const renderFollowups = this . viewOptions . renderFollowups ?? false ;
615634 const renderStyle = this . viewOptions . renderStyle ;
616635 this . createInput ( this . container , { renderFollowups, renderStyle } ) ;
@@ -863,8 +882,8 @@ export class ChatWidget extends Disposable implements IChatWidget {
863882
864883
865884 // reset the input in welcome view if it was rendered in experimental mode
866- if ( this . container . classList . contains ( 'experimental -welcome-view' ) && this . viewModel ?. getItems ( ) . length ) {
867- this . container . classList . remove ( 'experimental -welcome-view' ) ;
885+ if ( this . container . classList . contains ( 'new -welcome-view' ) && this . viewModel ?. getItems ( ) . length ) {
886+ this . container . classList . remove ( 'new -welcome-view' ) ;
868887 const renderFollowups = this . viewOptions . renderFollowups ?? false ;
869888 const renderStyle = this . viewOptions . renderStyle ;
870889 this . createInput ( this . container , { renderFollowups, renderStyle } ) ;
@@ -936,8 +955,8 @@ export class ChatWidget extends Disposable implements IChatWidget {
936955 ) , { isTrusted : { enabledCommands : [ generateInstructionsCommand ] } } ) ;
937956 }
938957 if ( this . contextKeyService . contextMatchesRules ( this . chatSetupTriggerContext ) ) {
939- welcomeContent = this . getExpWelcomeViewContent ( ) ;
940- this . container . classList . add ( 'experimental -welcome-view' ) ;
958+ welcomeContent = this . getNewWelcomeViewContent ( ) ;
959+ this . container . classList . add ( 'new -welcome-view' ) ;
941960 }
942961 else if ( expEmptyState ) {
943962 welcomeContent = this . getWelcomeViewContent ( additionalMessage , expEmptyState ) ;
@@ -1194,20 +1213,27 @@ export class ChatWidget extends Disposable implements IChatWidget {
11941213 }
11951214 }
11961215
1197- private getExpWelcomeViewContent ( ) : IChatViewWelcomeContent {
1216+ private getNewWelcomeViewContent ( ) : IChatViewWelcomeContent {
1217+ let additionalMessage : string | IMarkdownString | undefined = undefined ;
1218+ if ( this . chatEntitlementService . entitlement === ChatEntitlement . Unknown ) {
1219+ additionalMessage = new MarkdownString ( localize ( { key : 'settings' , comment : [ '{Locked="]({2})"}' , '{Locked="]({3})"}' ] } , "AI responses may be inaccurate.\nBy continuing with {0} Copilot, you agree to {1}'s [Terms]({2}) and [Privacy Statement]({3})." , defaultChat . provider . default . name , defaultChat . provider . default . name , defaultChat . termsStatementUrl , defaultChat . privacyStatementUrl ) , { isTrusted : true } ) ;
1220+ } else {
1221+ additionalMessage = localize ( 'expChatAdditionalMessage' , "AI responses may be inaccurate." ) ;
1222+ }
1223+
11981224 const welcomeContent : IChatViewWelcomeContent = {
11991225 title : localize ( 'expChatTitle' , 'Welcome to Copilot' ) ,
12001226 message : new MarkdownString ( localize ( 'expchatMessage' , "Let's get started" ) ) ,
12011227 icon : Codicon . copilotLarge ,
12021228 inputPart : this . inputPart . element ,
1203- additionalMessage : localize ( 'expChatAdditionalMessage' , "Review AI output carefully before use." ) ,
1204- isExperimental : true ,
1205- suggestedPrompts : this . getExpSuggestedPrompts ( ) ,
1229+ additionalMessage,
1230+ isNew : true ,
1231+ suggestedPrompts : this . getNewSuggestedPrompts ( ) ,
12061232 } ;
12071233 return welcomeContent ;
12081234 }
12091235
1210- private getExpSuggestedPrompts ( ) : IChatSuggestedPrompts [ ] {
1236+ private getNewSuggestedPrompts ( ) : IChatSuggestedPrompts [ ] {
12111237 // Check if the workbench is empty
12121238 const isEmpty = this . contextService . getWorkbenchState ( ) === WorkbenchState . EMPTY ;
12131239 if ( isEmpty ) {
@@ -2368,7 +2394,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
23682394 this . inlineInputPart ?. layout ( layoutHeight , width ) ;
23692395 }
23702396
2371- if ( this . container . classList . contains ( 'experimental -welcome-view' ) ) {
2397+ if ( this . container . classList . contains ( 'new -welcome-view' ) ) {
23722398 this . inputPart . layout ( layoutHeight , Math . min ( width , 650 ) ) ;
23732399 }
23742400 else {
0 commit comments