mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 08:15:56 +01:00
Polish for experiment gating
This commit is contained in:
@@ -234,6 +234,7 @@ export class AgentTitleBarStatusWidget extends BaseActionViewItem {
|
||||
|| e.affectsConfiguration(ChatConfiguration.ChatViewSessionsEnabled)
|
||||
|| e.affectsConfiguration(ChatConfiguration.AIDisabled)
|
||||
|| e.affectsConfiguration(ChatConfiguration.ChatCustomizationMenuEnabled)
|
||||
|| e.affectsConfiguration(ChatConfiguration.SignInTitleBarEnabled)
|
||||
|| e.affectsConfiguration('disableAICustomizations')
|
||||
|| e.affectsConfiguration('workbench.disableAICustomizations')
|
||||
) {
|
||||
@@ -870,8 +871,9 @@ export class AgentTitleBarStatusWidget extends BaseActionViewItem {
|
||||
let primaryActionTitle = localize('toggleChat', "Toggle Chat");
|
||||
let primaryActionIcon = Codicon.chatSparkle;
|
||||
|
||||
const signInTitleBarEnabled = this.configurationService.getValue<boolean>(ChatConfiguration.SignInTitleBarEnabled);
|
||||
if (chatSentiment.installed && !chatSentiment.disabled) {
|
||||
if (signedOut && !anonymous) {
|
||||
if (signedOut && !anonymous && !signInTitleBarEnabled) {
|
||||
primaryActionId = CHAT_SETUP_ACTION_ID;
|
||||
primaryActionTitle = localize('signInToChatSetup', "Sign in to use AI features...");
|
||||
primaryActionIcon = Codicon.chatSparkleError;
|
||||
|
||||
@@ -65,6 +65,8 @@ const defaultChat = {
|
||||
chatRefreshTokenCommand: product.defaultChatAgent?.chatRefreshTokenCommand ?? '',
|
||||
};
|
||||
|
||||
const SIGN_IN_TITLE_BAR_ACTION_ID = 'workbench.action.chat.signInIndicator';
|
||||
|
||||
export class ChatSetupContribution extends Disposable implements IWorkbenchContribution {
|
||||
|
||||
static readonly ID = 'workbench.contrib.chatSetup';
|
||||
@@ -369,7 +371,7 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
|
||||
|
||||
class ChatSetupSignInTitleBarAction extends Action2 {
|
||||
|
||||
static readonly ID = 'workbench.action.chat.signInIndicator';
|
||||
static readonly ID = SIGN_IN_TITLE_BAR_ACTION_ID;
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
@@ -602,7 +604,7 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
|
||||
|
||||
this._register(actionViewItemService.register(
|
||||
MenuId.TitleBarAdjacentCenter,
|
||||
'workbench.action.chat.signInIndicator',
|
||||
SIGN_IN_TITLE_BAR_ACTION_ID,
|
||||
(action, options) => new SignInTitleBarEntry(action, options)
|
||||
));
|
||||
}
|
||||
@@ -838,9 +840,9 @@ class SignInTitleBarEntry extends BaseActionViewItem {
|
||||
public override render(container: HTMLElement) {
|
||||
super.render(container);
|
||||
|
||||
container.setAttribute('aria-label', this.action.label);
|
||||
|
||||
const content = dom.append(container, dom.$('.update-indicator.prominent'));
|
||||
content.setAttribute('role', 'button');
|
||||
content.setAttribute('aria-label', this.action.label);
|
||||
const label = dom.append(content, dom.$('.indicator-label'));
|
||||
label.textContent = this.action.label;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import { disposableWindowInterval } from '../../../../../base/browser/dom.js';
|
||||
import { isNewUser } from './chatStatus.js';
|
||||
import product from '../../../../../platform/product/common/product.js';
|
||||
import { isCompletionsEnabled } from '../../../../../editor/common/services/completionsEnablement.js';
|
||||
import { ChatConfiguration } from '../../common/constants.js';
|
||||
|
||||
export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribution {
|
||||
|
||||
@@ -84,7 +85,7 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
|
||||
this._register(this.editorService.onDidActiveEditorChange(() => this.onDidActiveEditorChange()));
|
||||
|
||||
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration(product.defaultChatAgent?.completionsEnablementSetting)) {
|
||||
if (e.affectsConfiguration(product.defaultChatAgent?.completionsEnablementSetting) || e.affectsConfiguration(ChatConfiguration.SignInTitleBarEnabled)) {
|
||||
this.update();
|
||||
}
|
||||
}));
|
||||
@@ -147,11 +148,17 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
|
||||
|
||||
// Signed out
|
||||
else if (this.chatEntitlementService.entitlement === ChatEntitlement.Unknown) {
|
||||
const signedOutWarning = localize('notSignedIn', "Sign In");
|
||||
|
||||
text = `${this.chatEntitlementService.anonymous ? '$(copilot)' : '$(copilot-not-connected)'} ${signedOutWarning}`;
|
||||
ariaLabel = signedOutWarning;
|
||||
kind = 'prominent';
|
||||
const signInExperiment = this.configurationService.getValue<boolean>(ChatConfiguration.SignInTitleBarEnabled);
|
||||
if (signInExperiment) {
|
||||
const signIn = localize('signIn', "Sign In");
|
||||
text = `$(copilot) ${signIn}`;
|
||||
ariaLabel = signIn;
|
||||
} else {
|
||||
const signedOut = localize('notSignedIn', "Signed Out");
|
||||
text = `${this.chatEntitlementService.anonymous ? '$(copilot)' : '$(copilot-not-connected)'} ${signedOut}`;
|
||||
ariaLabel = signedOut;
|
||||
kind = 'prominent';
|
||||
}
|
||||
}
|
||||
|
||||
// Free Quota Exceeded
|
||||
|
||||
Reference in New Issue
Block a user