Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/platform/chat/common/interactionService.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 { createServiceIdentifier } from '../../../util/common/services';
7
import { generateUuid } from '../../../util/vs/base/common/uuid';
8
9
export const IInteractionService = createServiceIdentifier<IInteractionService>('IInteractionService');
10
11
export interface IInteractionService {
12
readonly _serviceBrand: undefined;
13
14
readonly interactionId: string;
15
16
startInteraction(): void;
17
}
18
19
/**
20
* Simple service that tracks an interaction with a chat service
21
* This is used for grouping requests to a logical interaction with the UI
22
* It is just used for telemetry collection so is not 100% accurate, especially in the case of parallel interactions
23
*/
24
export class InteractionService implements IInteractionService {
25
_serviceBrand: undefined;
26
private _interactionId: string = generateUuid();
27
28
startInteraction(): void {
29
this._interactionId = generateUuid();
30
}
31
32
public get interactionId(): string {
33
return this._interactionId;
34
}
35
}
36
37