Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/prompt/node/feedbackReporter.ts
13399 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 { constObservable, IObservable } from '../../../util/vs/base/common/observableInternal';
8
import { InteractionOutcome, PromptQuery } from '../../inlineChat/node/promptCraftingTypes';
9
import { SearchFeedbackKind } from '../../workspaceSemanticSearch/node/semanticSearchTextSearchProvider';
10
import { Conversation, Turn } from '../common/conversation';
11
12
export const IFeedbackReporter = createServiceIdentifier<IFeedbackReporter>('IFeedbackReporter');
13
14
export interface IFeedbackReporter {
15
readonly _serviceBrand: undefined;
16
17
readonly canReport: IObservable<boolean>;
18
19
reportInline(conversation: Conversation, promptQuery: PromptQuery, interactionOutcome: InteractionOutcome): Promise<void>;
20
reportChat(turn: Turn): Promise<void>;
21
reportSearch(kind: SearchFeedbackKind): Promise<void>;
22
}
23
24
25
export class NullFeedbackReporterImpl implements IFeedbackReporter {
26
_serviceBrand: undefined;
27
28
readonly canReport = constObservable(false);
29
30
async reportInline(conversation: Conversation, promptQuery: PromptQuery, interactionOutcome: InteractionOutcome): Promise<void> {
31
// nothing
32
}
33
34
async reportChat(turn: Turn): Promise<void> {
35
// nothing
36
}
37
38
async reportSearch(): Promise<void> {
39
// nothing
40
}
41
}
42
43
export const NullFeedbackReporter = new NullFeedbackReporterImpl();
44
45