Path: blob/main/src/vs/workbench/contrib/chat/test/common/mockChatService.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { CancellationToken } from '../../../../../base/common/cancellation.js';6import { Event } from '../../../../../base/common/event.js';7import { observableValue } from '../../../../../base/common/observable.js';8import { URI } from '../../../../../base/common/uri.js';9import { ChatModel, IChatModel, IChatRequestModel, IChatRequestVariableData, ISerializableChatData } from '../../common/chatModel.js';10import { IParsedChatRequest } from '../../common/chatParserTypes.js';11import { IChatCompleteResponse, IChatDetail, IChatProviderInfo, IChatSendRequestData, IChatSendRequestOptions, IChatService, IChatTransferredSessionData, IChatUserActionEvent } from '../../common/chatService.js';12import { ChatAgentLocation } from '../../common/constants.js';1314export class MockChatService implements IChatService {15requestInProgressObs = observableValue('name', false);16edits2Enabled: boolean = false;17_serviceBrand: undefined;18transferredSessionData: IChatTransferredSessionData | undefined;19onDidSubmitRequest: Event<{ chatSessionId: string }> = Event.None;2021private sessions = new Map<string, IChatModel>();2223isEnabled(location: ChatAgentLocation): boolean {24throw new Error('Method not implemented.');25}26hasSessions(): boolean {27throw new Error('Method not implemented.');28}29getProviderInfos(): IChatProviderInfo[] {30throw new Error('Method not implemented.');31}32startSession(location: ChatAgentLocation, token: CancellationToken): ChatModel {33throw new Error('Method not implemented.');34}35addSession(session: IChatModel): void {36this.sessions.set(session.sessionId, session);37}38getSession(sessionId: string): IChatModel | undefined {39// eslint-disable-next-line local/code-no-dangerous-type-assertions40return this.sessions.get(sessionId) ?? {} as IChatModel;41}42async getOrRestoreSession(sessionId: string): Promise<IChatModel | undefined> {43throw new Error('Method not implemented.');44}45getPersistedSessionTitle(sessionId: string): string | undefined {46throw new Error('Method not implemented.');47}48loadSessionFromContent(data: ISerializableChatData): IChatModel | undefined {49throw new Error('Method not implemented.');50}51loadSessionForResource(resource: URI, position: ChatAgentLocation, token: CancellationToken): Promise<IChatModel | undefined> {52throw new Error('Method not implemented.');53}54/**55* Returns whether the request was accepted.56*/57sendRequest(sessionId: string, message: string): Promise<IChatSendRequestData | undefined> {58throw new Error('Method not implemented.');59}60resendRequest(request: IChatRequestModel, options?: IChatSendRequestOptions | undefined): Promise<void> {61throw new Error('Method not implemented.');62}63adoptRequest(sessionId: string, request: IChatRequestModel): Promise<void> {64throw new Error('Method not implemented.');65}66removeRequest(sessionid: string, requestId: string): Promise<void> {67throw new Error('Method not implemented.');68}69cancelCurrentRequestForSession(sessionId: string): void {70throw new Error('Method not implemented.');71}72clearSession(sessionId: string): Promise<void> {73throw new Error('Method not implemented.');74}75addCompleteRequest(sessionId: string, message: IParsedChatRequest | string, variableData: IChatRequestVariableData | undefined, attempt: number | undefined, response: IChatCompleteResponse): void {76throw new Error('Method not implemented.');77}78async getHistory(): Promise<IChatDetail[]> {79throw new Error('Method not implemented.');80}81async clearAllHistoryEntries() {82throw new Error('Method not implemented.');83}84async removeHistoryEntry(sessionId: string) {85throw new Error('Method not implemented.');86}8788onDidPerformUserAction: Event<IChatUserActionEvent> = undefined!;89notifyUserAction(event: IChatUserActionEvent): void {90throw new Error('Method not implemented.');91}92onDidDisposeSession: Event<{ sessionId: string; reason: 'cleared' }> = undefined!;9394transferChatSession(transferredSessionData: IChatTransferredSessionData, toWorkspace: URI): void {95throw new Error('Method not implemented.');96}9798setChatSessionTitle(sessionId: string, title: string): void {99throw new Error('Method not implemented.');100}101102isEditingLocation(location: ChatAgentLocation): boolean {103throw new Error('Method not implemented.');104}105106getChatStorageFolder(): URI {107throw new Error('Method not implemented.');108}109110logChatIndex(): void {111throw new Error('Method not implemented.');112}113114isPersistedSessionEmpty(sessionId: string): boolean {115throw new Error('Method not implemented.');116}117118activateDefaultAgent(location: ChatAgentLocation): Promise<void> {119throw new Error('Method not implemented.');120}121}122123124