Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/chat/test/common/mockChatService.ts
3296 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 { CancellationToken } from '../../../../../base/common/cancellation.js';
7
import { Event } from '../../../../../base/common/event.js';
8
import { observableValue } from '../../../../../base/common/observable.js';
9
import { URI } from '../../../../../base/common/uri.js';
10
import { ChatModel, IChatModel, IChatRequestModel, IChatRequestVariableData, ISerializableChatData } from '../../common/chatModel.js';
11
import { IParsedChatRequest } from '../../common/chatParserTypes.js';
12
import { IChatCompleteResponse, IChatDetail, IChatProviderInfo, IChatSendRequestData, IChatSendRequestOptions, IChatService, IChatTransferredSessionData, IChatUserActionEvent } from '../../common/chatService.js';
13
import { ChatAgentLocation } from '../../common/constants.js';
14
15
export class MockChatService implements IChatService {
16
requestInProgressObs = observableValue('name', false);
17
edits2Enabled: boolean = false;
18
_serviceBrand: undefined;
19
transferredSessionData: IChatTransferredSessionData | undefined;
20
onDidSubmitRequest: Event<{ chatSessionId: string }> = Event.None;
21
22
private sessions = new Map<string, IChatModel>();
23
24
isEnabled(location: ChatAgentLocation): boolean {
25
throw new Error('Method not implemented.');
26
}
27
hasSessions(): boolean {
28
throw new Error('Method not implemented.');
29
}
30
getProviderInfos(): IChatProviderInfo[] {
31
throw new Error('Method not implemented.');
32
}
33
startSession(location: ChatAgentLocation, token: CancellationToken): ChatModel {
34
throw new Error('Method not implemented.');
35
}
36
addSession(session: IChatModel): void {
37
this.sessions.set(session.sessionId, session);
38
}
39
getSession(sessionId: string): IChatModel | undefined {
40
// eslint-disable-next-line local/code-no-dangerous-type-assertions
41
return this.sessions.get(sessionId) ?? {} as IChatModel;
42
}
43
async getOrRestoreSession(sessionId: string): Promise<IChatModel | undefined> {
44
throw new Error('Method not implemented.');
45
}
46
getPersistedSessionTitle(sessionId: string): string | undefined {
47
throw new Error('Method not implemented.');
48
}
49
loadSessionFromContent(data: ISerializableChatData): IChatModel | undefined {
50
throw new Error('Method not implemented.');
51
}
52
loadSessionForResource(resource: URI, position: ChatAgentLocation, token: CancellationToken): Promise<IChatModel | undefined> {
53
throw new Error('Method not implemented.');
54
}
55
/**
56
* Returns whether the request was accepted.
57
*/
58
sendRequest(sessionId: string, message: string): Promise<IChatSendRequestData | undefined> {
59
throw new Error('Method not implemented.');
60
}
61
resendRequest(request: IChatRequestModel, options?: IChatSendRequestOptions | undefined): Promise<void> {
62
throw new Error('Method not implemented.');
63
}
64
adoptRequest(sessionId: string, request: IChatRequestModel): Promise<void> {
65
throw new Error('Method not implemented.');
66
}
67
removeRequest(sessionid: string, requestId: string): Promise<void> {
68
throw new Error('Method not implemented.');
69
}
70
cancelCurrentRequestForSession(sessionId: string): void {
71
throw new Error('Method not implemented.');
72
}
73
clearSession(sessionId: string): Promise<void> {
74
throw new Error('Method not implemented.');
75
}
76
addCompleteRequest(sessionId: string, message: IParsedChatRequest | string, variableData: IChatRequestVariableData | undefined, attempt: number | undefined, response: IChatCompleteResponse): void {
77
throw new Error('Method not implemented.');
78
}
79
async getHistory(): Promise<IChatDetail[]> {
80
throw new Error('Method not implemented.');
81
}
82
async clearAllHistoryEntries() {
83
throw new Error('Method not implemented.');
84
}
85
async removeHistoryEntry(sessionId: string) {
86
throw new Error('Method not implemented.');
87
}
88
89
onDidPerformUserAction: Event<IChatUserActionEvent> = undefined!;
90
notifyUserAction(event: IChatUserActionEvent): void {
91
throw new Error('Method not implemented.');
92
}
93
onDidDisposeSession: Event<{ sessionId: string; reason: 'cleared' }> = undefined!;
94
95
transferChatSession(transferredSessionData: IChatTransferredSessionData, toWorkspace: URI): void {
96
throw new Error('Method not implemented.');
97
}
98
99
setChatSessionTitle(sessionId: string, title: string): void {
100
throw new Error('Method not implemented.');
101
}
102
103
isEditingLocation(location: ChatAgentLocation): boolean {
104
throw new Error('Method not implemented.');
105
}
106
107
getChatStorageFolder(): URI {
108
throw new Error('Method not implemented.');
109
}
110
111
logChatIndex(): void {
112
throw new Error('Method not implemented.');
113
}
114
115
isPersistedSessionEmpty(sessionId: string): boolean {
116
throw new Error('Method not implemented.');
117
}
118
119
activateDefaultAgent(location: ChatAgentLocation): Promise<void> {
120
throw new Error('Method not implemented.');
121
}
122
}
123
124