Skip to content

Commit 1d89ed6

Browse files
authored
Merge pull request microsoft#252758 from microsoft/ben/melodic-platypus
chat - prepare dialog experiments with alternate provider
2 parents 384ad08 + 6ededbe commit 1d89ed6

File tree

3 files changed

+33
-123
lines changed

3 files changed

+33
-123
lines changed

src/vs/workbench/contrib/chat/browser/chat.contribution.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -465,16 +465,9 @@ configurationRegistry.registerConfiguration({
465465
},
466466
],
467467
},
468-
'chat.setup.signInWithAlternateProvider': { // TODO@bpasero remove me eventually
469-
type: 'string',
470-
enum: ['off', 'monochrome', 'colorful', 'first'],
471-
description: nls.localize('chat.signInWithAlternateProvider', "Enable alternative sign-in provider."),
472-
default: 'off',
473-
tags: ['onExp', 'experimental'],
474-
},
475468
'chat.setup.signInDialogVariant': { // TODO@bpasero remove me eventually
476469
type: 'string',
477-
enum: ['default', 'brand-gh', 'brand-vsc', 'style-glow', 'account-create'],
470+
enum: ['default', 'alternate-first', 'alternate-color', 'alternate-monochrome'],
478471
description: nls.localize('chat.signInDialogVariant', "Control variations of the sign-in dialog."),
479472
default: 'default',
480473
tags: ['onExp', 'experimental']

src/vs/workbench/contrib/chat/browser/chatSetup.ts

Lines changed: 32 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ import { CHAT_CATEGORY, CHAT_OPEN_ACTION_ID, CHAT_SETUP_ACTION_ID } from './acti
6868
import { ChatViewId, IChatWidgetService, showCopilotView } from './chat.js';
6969
import { CHAT_SIDEBAR_PANEL_ID } from './chatViewPane.js';
7070
import { coalesce } from '../../../../base/common/arrays.js';
71-
import { ThemeIcon } from '../../../../base/common/themables.js';
7271
import { IButton } from '../../../../base/browser/ui/button/button.js';
7372
import { ChatMode2 } from '../common/chatModes.js';
7473
import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.js';
@@ -592,7 +591,7 @@ class ChatSetup {
592591
let instance = ChatSetup.instance;
593592
if (!instance) {
594593
instance = ChatSetup.instance = instantiationService.invokeFunction(accessor => {
595-
return new ChatSetup(context, controller, instantiationService, accessor.get(ITelemetryService), accessor.get(IWorkbenchLayoutService), accessor.get(IKeybindingService), accessor.get(IChatEntitlementService) as ChatEntitlementService, accessor.get(ILogService), accessor.get(IConfigurationService), accessor.get(IViewsService), accessor.get(IProductService), accessor.get(IOpenerService));
594+
return new ChatSetup(context, controller, instantiationService, accessor.get(ITelemetryService), accessor.get(IWorkbenchLayoutService), accessor.get(IKeybindingService), accessor.get(IChatEntitlementService) as ChatEntitlementService, accessor.get(ILogService), accessor.get(IConfigurationService), accessor.get(IViewsService), accessor.get(IOpenerService));
596595
});
597596
}
598597

@@ -614,7 +613,6 @@ class ChatSetup {
614613
@ILogService private readonly logService: ILogService,
615614
@IConfigurationService private readonly configurationService: IConfigurationService,
616615
@IViewsService private readonly viewsService: IViewsService,
617-
@IProductService private readonly productService: IProductService,
618616
@IOpenerService private readonly openerService: IOpenerService,
619617
) { }
620618

@@ -691,40 +689,20 @@ class ChatSetup {
691689
}
692690

693691
private async showDialog(): Promise<ChatSetupStrategy> {
694-
let dialogVariant = this.configurationService.getValue<'default' | 'brand-gh' | 'brand-vsc' | 'style-glow' | 'account-create' | unknown>('chat.setup.signInDialogVariant');
695-
if (this.context.state.entitlement !== ChatEntitlement.Unknown && dialogVariant === 'account-create') {
696-
dialogVariant = 'default'; // fallback to modern/default for users that are signed in already
697-
}
698-
699692
const disposables = new DisposableStore();
700693

694+
const dialogVariant = this.configurationService.getValue<'default' | 'alternate-first' | 'alternate-color' | 'alternate-monochrome' | unknown>('chat.setup.signInDialogVariant');
701695
const buttons = this.getButtons(dialogVariant);
702696

703-
let icon: ThemeIcon;
704-
switch (dialogVariant) {
705-
case 'brand-gh':
706-
icon = Codicon.github;
707-
break;
708-
case 'brand-vsc':
709-
icon = this.productService.quality === 'stable' ? Codicon.vscode : this.productService.quality === 'insider' ? Codicon.vscodeInsiders : Codicon.codeOss;
710-
break;
711-
default:
712-
icon = Codicon.copilotLarge;
713-
break;
714-
}
715-
716697
const dialog = disposables.add(new Dialog(
717698
this.layoutService.activeContainer,
718-
this.getDialogTitle(dialogVariant),
699+
this.getDialogTitle(),
719700
buttons.map(button => button[0]),
720701
createWorkbenchDialogOptions({
721702
type: 'none',
722-
extraClasses: coalesce([
723-
'chat-setup-dialog',
724-
dialogVariant === 'style-glow' ? 'chat-setup-glow' : undefined
725-
]),
703+
extraClasses: ['chat-setup-dialog'],
726704
detail: ' ', // workaround allowing us to render the message in large
727-
icon,
705+
icon: Codicon.copilotLarge,
728706
alignment: DialogContentsAlignment.Vertical,
729707
cancelId: buttons.length - 1,
730708
disableCloseButton: true,
@@ -739,77 +717,54 @@ class ChatSetup {
739717
return buttons[button]?.[1] ?? ChatSetupStrategy.Canceled;
740718
}
741719

742-
private getButtons(variant: unknown): Array<[string, ChatSetupStrategy, { styleButton?: (button: IButton) => void } | undefined]> {
720+
private getButtons(variant: 'default' | 'alternate-first' | 'alternate-color' | 'alternate-monochrome' | unknown): Array<[string, ChatSetupStrategy, { styleButton?: (button: IButton) => void } | undefined]> {
743721
let buttons: Array<[string, ChatSetupStrategy, { styleButton?: (button: IButton) => void } | undefined]>;
744722

745723
if (this.context.state.entitlement === ChatEntitlement.Unknown) {
746724
let alternateProvider: 'off' | 'monochrome' | 'colorful' | 'first' = 'off';
747-
const alternateProviderSetting: unknown = this.configurationService.getValue('chat.setup.signInWithAlternateProvider');
748-
if (alternateProviderSetting === true) {
749-
alternateProvider = 'colorful';
750-
} else if (alternateProviderSetting === 'monochrome' || alternateProviderSetting === 'colorful' || alternateProviderSetting === 'first') {
751-
alternateProvider = alternateProviderSetting;
725+
if (defaultChat.alternativeProviderId) {
726+
switch (variant) {
727+
case 'alternate-first':
728+
alternateProvider = 'first';
729+
break;
730+
case 'alternate-color':
731+
alternateProvider = 'colorful';
732+
break;
733+
case 'alternate-monochrome':
734+
alternateProvider = 'monochrome';
735+
break;
736+
}
752737
}
753738

754-
const enableAlternateProvider = alternateProvider !== 'off' && defaultChat.alternativeProviderId;
755-
756739
if (ChatEntitlementRequests.providerId(this.configurationService) === defaultChat.enterpriseProviderId) {
757740
buttons = coalesce([
758741
[localize('continueWith', "Continue with {0}", defaultChat.enterpriseProviderName), ChatSetupStrategy.SetupWithEnterpriseProvider, {
759-
styleButton: button => {
760-
button.element.classList.add('continue-button', 'default');
761-
}
742+
styleButton: button => button.element.classList.add('continue-button', 'default')
762743
}],
763-
enableAlternateProvider ? [localize('continueWith', "Continue with {0}", defaultChat.alternativeProviderName), ChatSetupStrategy.SetupWithAlternateProvider, {
764-
styleButton: button => {
765-
button.element.classList.add('continue-button', 'alternate', alternateProvider);
766-
}
744+
alternateProvider !== 'off' ? [localize('continueWith', "Continue with {0}", defaultChat.alternativeProviderName), ChatSetupStrategy.SetupWithAlternateProvider, {
745+
styleButton: button => button.element.classList.add('continue-button', 'alternate', alternateProvider)
767746
}] : undefined,
768-
[variant !== 'account-create' ? localize('signInWithProvider', "Sign in with a {0} account", defaultChat.providerName) : localize('continueWithProvider', "Continue with {0}", defaultChat.providerName), ChatSetupStrategy.SetupWithoutEnterpriseProvider, {
769-
styleButton: button => {
770-
if (variant !== 'account-create') {
771-
button.element.classList.add('link-button');
772-
} else {
773-
button.element.classList.add('continue-button', 'default');
774-
}
775-
}
747+
[localize('signInWithProvider', "Sign in with a {0} account", defaultChat.providerName), ChatSetupStrategy.SetupWithoutEnterpriseProvider, {
748+
styleButton: button => button.element.classList.add('link-button')
776749
}]
777750
]);
778751
} else {
779752
buttons = coalesce([
780753
[localize('continueWith', "Continue with {0}", defaultChat.providerName), ChatSetupStrategy.SetupWithoutEnterpriseProvider, {
781-
styleButton: button => {
782-
button.element.classList.add('continue-button', 'default');
783-
}
754+
styleButton: button => button.element.classList.add('continue-button', 'default')
784755
}],
785-
enableAlternateProvider ? [localize('continueWith', "Continue with {0}", defaultChat.alternativeProviderName), ChatSetupStrategy.SetupWithAlternateProvider, {
786-
styleButton: button => {
787-
button.element.classList.add('continue-button', 'alternate', alternateProvider);
788-
}
756+
alternateProvider !== 'off' ? [localize('continueWith', "Continue with {0}", defaultChat.alternativeProviderName), ChatSetupStrategy.SetupWithAlternateProvider, {
757+
styleButton: button => button.element.classList.add('continue-button', 'alternate', alternateProvider)
789758
}] : undefined,
790-
[variant !== 'account-create' ? localize('signInWithProvider', "Sign in with a {0} account", defaultChat.enterpriseProviderName) : localize('continueWithProvider', "Continue with {0}", defaultChat.enterpriseProviderName), ChatSetupStrategy.SetupWithEnterpriseProvider, {
791-
styleButton: button => {
792-
if (variant !== 'account-create') {
793-
button.element.classList.add('link-button');
794-
} else {
795-
button.element.classList.add('continue-button', 'default');
796-
}
797-
}
759+
[localize('signInWithProvider', "Sign in with a {0} account", defaultChat.enterpriseProviderName), ChatSetupStrategy.SetupWithEnterpriseProvider, {
760+
styleButton: button => button.element.classList.add('link-button')
798761
}]
799762
]);
800763
}
801764

802-
if (enableAlternateProvider && alternateProvider === 'first') {
765+
if (alternateProvider === 'first') {
803766
[buttons[0], buttons[1]] = [buttons[1], buttons[0]];
804767
}
805-
806-
if (variant === 'account-create') {
807-
buttons.push([localize('createAccount', "Create a New Account"), ChatSetupStrategy.SetupWithAccountCreate, {
808-
styleButton: button => {
809-
button.element.classList.add('link-button');
810-
}
811-
}]);
812-
}
813768
} else {
814769
buttons = [[localize('setupCopilotButton', "Set up Copilot"), ChatSetupStrategy.DefaultSetup, undefined]];
815770
}
@@ -819,26 +774,12 @@ class ChatSetup {
819774
return buttons;
820775
}
821776

822-
private getDialogTitle(variant: unknown): string {
777+
private getDialogTitle(): string {
823778
if (this.context.state.entitlement === ChatEntitlement.Unknown) {
824-
switch (variant) {
825-
case 'brand-gh':
826-
return localize('signInGH', "Sign in to use {0} Copilot", defaultChat.providerName);
827-
case 'brand-vsc':
828-
return localize('signInVSC', "Sign in to use AI");
829-
default:
830-
return localize('signIn', "Sign in to use Copilot");
831-
}
779+
return localize('signIn', "Sign in to use Copilot");
832780
}
833781

834-
switch (variant) {
835-
case 'brand-gh':
836-
return localize('startUsingGh', "Start using {0} Copilot", defaultChat.providerName);
837-
case 'brand-vsc':
838-
return localize('startUsingVSC', "Start using AI");
839-
default:
840-
return localize('startUsing', "Start using Copilot");
841-
}
782+
return localize('startUsing', "Start using Copilot");
842783
}
843784

844785
private createDialogFooter(disposables: DisposableStore): HTMLElement {

src/vs/workbench/contrib/chat/browser/media/chatSetup.css

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,6 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
/* Glowing Animation */
7-
8-
@property --chat-setup-dialog-glow-angle {
9-
syntax: '<angle>';
10-
initial-value: 0deg;
11-
inherits: false;
12-
}
13-
14-
@keyframes chat-setup-dialog-glow-angle-animation {
15-
0% {
16-
--chat-setup-dialog-glow-angle: 0deg;
17-
}
18-
19-
100% {
20-
--chat-setup-dialog-glow-angle: 360deg;
21-
}
22-
}
23-
24-
.chat-setup-dialog.chat-setup-glow {
25-
border: 2px solid !important;
26-
border-image: linear-gradient(var(--chat-setup-dialog-glow-angle), var(--vscode-button-background) 0, var(--vscode-editorGutter-addedBackground)) 1 !important;
27-
animation: 3s chat-setup-dialog-glow-angle-animation linear infinite;
28-
}
29-
306
.chat-setup-dialog {
317

328
/* Continue Buttons */

0 commit comments

Comments
 (0)