Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/platform/endpoint/node/copilotChatEndpoint.ts
13401 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 { IInstantiationService } from '../../../util/vs/platform/instantiation/common/instantiation';
7
import { IAuthenticationService } from '../../authentication/common/authentication';
8
import { IChatMLFetcher } from '../../chat/common/chatMLFetcher';
9
import { IConfigurationService } from '../../configuration/common/configurationService';
10
import { IEnvService } from '../../env/common/envService';
11
import { ILogService } from '../../log/common/logService';
12
import { IFetcherService } from '../../networking/common/fetcherService';
13
import { RawMessageConversionCallback } from '../../networking/common/openai';
14
import { IChatWebSocketManager } from '../../networking/node/chatWebSocketManager';
15
import { IExperimentationService } from '../../telemetry/common/nullExperimentationService';
16
import { ITelemetryService } from '../../telemetry/common/telemetry';
17
import { ITokenizerProvider } from '../../tokenizer/node/tokenizer';
18
import { ICAPIClientService } from '../common/capiClient';
19
import { IDomainService } from '../common/domainService';
20
import { IChatModelInformation } from '../common/endpointProvider';
21
import { ChatEndpoint } from './chatEndpoint';
22
23
export class CopilotChatEndpoint extends ChatEndpoint {
24
constructor(
25
modelMetadata: IChatModelInformation,
26
@IDomainService domainService: IDomainService,
27
@ICAPIClientService capiClientService: ICAPIClientService,
28
@IFetcherService fetcherService: IFetcherService,
29
@IEnvService envService: IEnvService,
30
@ITelemetryService telemetryService: ITelemetryService,
31
@IAuthenticationService authService: IAuthenticationService,
32
@IChatMLFetcher chatMLFetcher: IChatMLFetcher,
33
@ITokenizerProvider tokenizerProvider: ITokenizerProvider,
34
@IInstantiationService instantiationService: IInstantiationService,
35
@IConfigurationService configurationService: IConfigurationService,
36
@IExperimentationService experimentService: IExperimentationService,
37
@IChatWebSocketManager chatWebSocketService: IChatWebSocketManager,
38
@ILogService logService: ILogService
39
) {
40
super(
41
modelMetadata,
42
domainService,
43
chatMLFetcher,
44
tokenizerProvider,
45
instantiationService,
46
configurationService,
47
experimentService,
48
chatWebSocketService,
49
logService
50
);
51
}
52
53
protected override getCompletionsCallback(): RawMessageConversionCallback | undefined {
54
return (out, data) => {
55
if (data && data.id) {
56
out.reasoning_opaque = data.id;
57
out.reasoning_text = Array.isArray(data.text) ? data.text.join('') : data.text;
58
}
59
};
60
}
61
}
62
63