Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatus.ts
4780 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { ChatEntitlement, IChatEntitlementService } from '../../../../services/chat/common/chatEntitlementService.js';
7
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';
8
import product from '../../../../../platform/product/common/product.js';
9
import { isObject } from '../../../../../base/common/types.js';
10
11
export function isNewUser(chatEntitlementService: IChatEntitlementService): boolean {
12
return !chatEntitlementService.sentiment.installed || // chat not installed
13
chatEntitlementService.entitlement === ChatEntitlement.Available; // not yet signed up to chat
14
}
15
16
export function isCompletionsEnabled(configurationService: IConfigurationService, modeId: string = '*'): boolean {
17
const result = configurationService.getValue<Record<string, boolean>>(product.defaultChatAgent.completionsEnablementSetting);
18
if (!isObject(result)) {
19
return false;
20
}
21
22
if (typeof result[modeId] !== 'undefined') {
23
return Boolean(result[modeId]); // go with setting if explicitly defined
24
}
25
26
return Boolean(result['*']); // fallback to global setting otherwise
27
}
28
29