@@ -246,7 +246,7 @@ export class AIProviderService implements Disposable {
246246 } ;
247247 const source : Parameters < TelemetryService [ 'sendEvent' ] > [ 2 ] = { source : sourceContext . source } ;
248248
249- const confirmed = await confirmAIProviderToS ( model , this . container . storage ) ;
249+ const confirmed = await confirmAIProviderToS ( this , model , this . container . storage ) ;
250250 if ( ! confirmed ) {
251251 this . container . telemetry . sendEvent ( 'ai/generate' , { ...payload , 'failed.reason' : 'user-declined' } , source ) ;
252252
@@ -327,7 +327,7 @@ export class AIProviderService implements Disposable {
327327 } ;
328328 const source : Parameters < TelemetryService [ 'sendEvent' ] > [ 2 ] = { source : sourceContext . source } ;
329329
330- const confirmed = await confirmAIProviderToS ( model , this . container . storage ) ;
330+ const confirmed = await confirmAIProviderToS ( this , model , this . container . storage ) ;
331331 if ( ! confirmed ) {
332332 this . container . telemetry . sendEvent ( 'ai/generate' , { ...payload , 'failed.reason' : 'user-declined' } , source ) ;
333333
@@ -427,7 +427,7 @@ export class AIProviderService implements Disposable {
427427 } ;
428428 const source : Parameters < TelemetryService [ 'sendEvent' ] > [ 2 ] = { source : sourceContext . source } ;
429429
430- const confirmed = await confirmAIProviderToS ( model , this . container . storage ) ;
430+ const confirmed = await confirmAIProviderToS ( this , model , this . container . storage ) ;
431431 if ( ! confirmed ) {
432432 this . container . telemetry . sendEvent ( 'ai/explain' , { ...payload , 'failed.reason' : 'user-declined' } , source ) ;
433433
@@ -546,6 +546,7 @@ export class AIProviderService implements Disposable {
546546}
547547
548548async function confirmAIProviderToS < Provider extends AIProviders > (
549+ service : AIProviderService ,
549550 model : AIModel < Provider , AIModels < Provider > > ,
550551 storage : Storage ,
551552) : Promise < boolean > {
@@ -555,20 +556,28 @@ async function confirmAIProviderToS<Provider extends AIProviders>(
555556 if ( confirmed ) return true ;
556557
557558 const accept : MessageItem = { title : 'Continue' } ;
559+ const switchModel : MessageItem = { title : 'Switch Model' } ;
558560 const acceptWorkspace : MessageItem = { title : 'Always for this Workspace' } ;
559561 const acceptAlways : MessageItem = { title : 'Always' } ;
560562 const decline : MessageItem = { title : 'Cancel' , isCloseAffordance : true } ;
563+
561564 const result = await window . showInformationMessage (
562565 `GitLens AI features require sending a diff of the code changes to ${ model . provider . name } for analysis. This may contain sensitive information.\n\nDo you want to continue?` ,
563566 { modal : true } ,
564567 accept ,
568+ switchModel ,
565569 acceptWorkspace ,
566570 acceptAlways ,
567571 decline ,
568572 ) ;
569573
570574 if ( result === accept ) return true ;
571575
576+ if ( result === switchModel ) {
577+ void service . switchModel ( ) ;
578+ return false ;
579+ }
580+
572581 if ( result === acceptWorkspace ) {
573582 void storage . storeWorkspace ( `confirm:ai:tos:${ model . provider . id } ` , true ) . catch ( ) ;
574583 return true ;
0 commit comments