Skip to content

Commit 787be8b

Browse files
authored
chat - setup tweaks and enablement (microsoft#235750)
1 parent 4d66061 commit 787be8b

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,10 @@ configurationRegistry.registerConfiguration({
123123
},
124124
'chat.experimental.offerSetup': {
125125
type: 'boolean',
126-
default: false,
126+
default: true,
127127
scope: ConfigurationScope.APPLICATION,
128128
markdownDescription: nls.localize('chat.experimental.offerSetup', "Controls whether setup is offered for Chat if not done already."),
129-
tags: ['experimental', 'onExP'],
130-
included: false
129+
tags: ['experimental', 'onExP']
131130
},
132131
'chat.editing.alwaysSaveWithGeneratedChanges': {
133132
type: 'boolean',

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

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import { IProgressService, ProgressLocation } from '../../../../platform/progres
3636
import { Registry } from '../../../../platform/registry/common/platform.js';
3737
import { asText, IRequestService } from '../../../../platform/request/common/request.js';
3838
import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
39-
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
39+
import { ITelemetryService, TelemetryLevel } from '../../../../platform/telemetry/common/telemetry.js';
4040
import { defaultButtonStyles } from '../../../../platform/theme/browser/defaultStyles.js';
4141
import { IWorkspaceContextService } from '../../../../platform/workspace/common/workspace.js';
4242
import { IWorkbenchContribution } from '../../../common/contributions.js';
@@ -67,12 +67,14 @@ const defaultChat = {
6767
termsStatementUrl: product.defaultChatAgent?.termsStatementUrl ?? '',
6868
privacyStatementUrl: product.defaultChatAgent?.privacyStatementUrl ?? '',
6969
skusDocumentationUrl: product.defaultChatAgent?.skusDocumentationUrl ?? '',
70+
publicCodeMatchesUrl: product.defaultChatAgent?.publicCodeMatchesUrl ?? '',
7071
upgradePlanUrl: product.defaultChatAgent?.upgradePlanUrl ?? '',
7172
providerId: product.defaultChatAgent?.providerId ?? '',
7273
providerName: product.defaultChatAgent?.providerName ?? '',
7374
providerScopes: product.defaultChatAgent?.providerScopes ?? [[]],
7475
entitlementUrl: product.defaultChatAgent?.entitlementUrl ?? '',
7576
entitlementSignupLimitedUrl: product.defaultChatAgent?.entitlementSignupLimitedUrl ?? '',
77+
manageSettingsUrl: product.defaultChatAgent?.manageSettingsUrl ?? '',
7678
};
7779

7880
enum ChatEntitlement {
@@ -581,7 +583,7 @@ class ChatSetupRequests extends Disposable {
581583

582584
async signUpLimited(session: AuthenticationSession): Promise<boolean> {
583585
const body = {
584-
restricted_telemetry: 'disabled',
586+
restricted_telemetry: this.telemetryService.telemetryLevel === TelemetryLevel.NONE ? 'disabled' : 'enabled',
585587
public_code_suggestions: 'enabled'
586588
};
587589

@@ -828,7 +830,8 @@ class ChatSetupWelcomeContent extends Disposable {
828830
private readonly context: ChatSetupContext,
829831
@IInstantiationService private readonly instantiationService: IInstantiationService,
830832
@IContextMenuService private readonly contextMenuService: IContextMenuService,
831-
@ICommandService private readonly commandService: ICommandService
833+
@ICommandService private readonly commandService: ICommandService,
834+
@ITelemetryService private readonly telemetryService: ITelemetryService,
832835
) {
833836
super();
834837

@@ -840,7 +843,7 @@ class ChatSetupWelcomeContent extends Disposable {
840843

841844
// Header
842845
{
843-
const header = localize({ key: 'setupHeader', comment: ['{Locked="[Copilot]({0})"}'] }, "[Copilot]({0} 'Copilot') is your AI pair programmer.", this.context.state.installed ? 'command:github.copilot.open.walkthrough' : defaultChat.documentationUrl);
846+
const header = localize({ key: 'header', comment: ['{Locked="[Copilot]({0})"}'] }, "[Copilot]({0}) is your AI pair programmer.", this.context.state.installed ? 'command:github.copilot.open.walkthrough' : defaultChat.documentationUrl);
844847
this.element.appendChild($('p')).appendChild(this._register(markdown.render(new MarkdownString(header, { isTrusted: true }))).element);
845848

846849
const features = this.element.appendChild($('div.chat-features-container'));
@@ -866,9 +869,9 @@ class ChatSetupWelcomeContent extends Disposable {
866869
}
867870

868871
// Limited SKU
869-
const limitedSkuHeader = '$(sparkle-filled) ' + localize({ key: 'limitedSkuHeader', comment: ['{Locked="[]({0})"}'] }, "We now offer [Copilot for free]({0}).", defaultChat.skusDocumentationUrl);
870-
const limitedSkuHeaderContainer = this.element.appendChild($('p'));
871-
limitedSkuHeaderContainer.appendChild(this._register(markdown.render(new MarkdownString(limitedSkuHeader, { isTrusted: true, supportThemeIcons: true }))).element);
872+
const free = localize({ key: 'free', comment: ['{Locked="[]({0})"}'] }, "$(sparkle-filled) We now offer [Copilot for free]({0}).", defaultChat.skusDocumentationUrl);
873+
const freeContainer = this.element.appendChild($('p'));
874+
freeContainer.appendChild(this._register(markdown.render(new MarkdownString(free, { isTrusted: true, supportThemeIcons: true }))).element);
872875

873876
// Setup Button
874877
const actions: IAction[] = [];
@@ -891,34 +894,40 @@ class ChatSetupWelcomeContent extends Disposable {
891894
this._register(button.onDidClick(() => this.controller.setup()));
892895

893896
// Terms
894-
const terms = localize({ key: 'termsLabel', comment: ['{Locked="["}', '{Locked="]({0})"}', '{Locked="]({1})"}'] }, "By continuing, you agree to the [Terms]({0}) and [Privacy Policy]({1}).", defaultChat.termsStatementUrl, defaultChat.privacyStatementUrl);
897+
const terms = localize({ key: 'terms', comment: ['{Locked="["}', '{Locked="]({0})"}', '{Locked="]({1})"}'] }, "By continuing, you agree to the [Terms]({0}) and [Privacy Policy]({1}).", defaultChat.termsStatementUrl, defaultChat.privacyStatementUrl);
895898
this.element.appendChild($('p')).appendChild(this._register(markdown.render(new MarkdownString(terms, { isTrusted: true }))).element);
896899

900+
// SKU Settings
901+
const settings = localize({ key: 'settings', comment: ['{Locked="["}', '{Locked="]({0})"}', '{Locked="]({1})"}'] }, "Copilot may show [public code]({0}) suggestions and collect telemetry. You can change these [settings]({1}) at any time.", defaultChat.publicCodeMatchesUrl, defaultChat.manageSettingsUrl);
902+
const settingsContainer = this.element.appendChild($('p'));
903+
settingsContainer.appendChild(this._register(markdown.render(new MarkdownString(settings, { isTrusted: true }))).element);
904+
897905
// Update based on model state
898-
this._register(Event.runAndSubscribe(this.controller.onDidChange, () => this.update(limitedSkuHeaderContainer, button)));
906+
this._register(Event.runAndSubscribe(this.controller.onDidChange, () => this.update(freeContainer, settingsContainer, button)));
899907
}
900908

901-
private update(limitedSkuHeaderContainer: HTMLElement, button: Button | ButtonWithDropdown): void {
902-
let showLimitedSkuHeader: boolean;
909+
private update(freeContainer: HTMLElement, settingsContainer: HTMLElement, button: Button | ButtonWithDropdown): void {
910+
const showSettings = this.telemetryService.telemetryLevel !== TelemetryLevel.NONE;
911+
let showFree: boolean;
903912
let buttonLabel: string;
904913

905914
switch (this.context.state.entitlement) {
906915
case ChatEntitlement.Unknown:
907-
showLimitedSkuHeader = true;
916+
showFree = true;
908917
buttonLabel = this.context.state.registered ? localize('signUp', "Sign in to Use Copilot") : localize('signUpFree', "Sign in to Use Copilot for Free");
909918
break;
910919
case ChatEntitlement.Unresolved:
911-
showLimitedSkuHeader = true;
920+
showFree = true;
912921
buttonLabel = this.context.state.registered ? localize('startUp', "Use Copilot") : localize('startUpLimited', "Use Copilot for Free");
913922
break;
914923
case ChatEntitlement.Available:
915924
case ChatEntitlement.Limited:
916-
showLimitedSkuHeader = true;
925+
showFree = true;
917926
buttonLabel = localize('startUpLimited', "Use Copilot for Free");
918927
break;
919928
case ChatEntitlement.Pro:
920929
case ChatEntitlement.Unavailable:
921-
showLimitedSkuHeader = false;
930+
showFree = false;
922931
buttonLabel = localize('startUp', "Use Copilot");
923932
break;
924933
}
@@ -932,7 +941,8 @@ class ChatSetupWelcomeContent extends Disposable {
932941
break;
933942
}
934943

935-
setVisibility(showLimitedSkuHeader, limitedSkuHeaderContainer);
944+
setVisibility(showFree, freeContainer);
945+
setVisibility(showSettings, settingsContainer);
936946

937947
button.label = buttonLabel;
938948
button.enabled = this.controller.step === ChatSetupStep.Initial;

0 commit comments

Comments
 (0)