Path: blob/main/extensions/copilot/src/extension/context/node/resolvers/genericPanelIntentInvocation.ts
13405 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*--------------------------------------------------------------------------------------------*/456import { BasePromptElementProps } from '@vscode/prompt-tsx';7import type * as vscode from 'vscode';8import { ChatLocation } from '../../../../platform/chat/common/commonTypes';9import { IChatEndpoint } from '../../../../platform/networking/common/networking';10import { IInstantiationService } from '../../../../util/vs/platform/instantiation/common/instantiation';11import { IBuildPromptContext } from '../../../prompt/common/intents';12import { IDocumentContext } from '../../../prompt/node/documentContext';13import { IIntent, IIntentInvocation } from '../../../prompt/node/intents';14import { PromptElementCtor } from '../../../prompts/node/base/promptElement';15import { PromptRenderer, RendererIntentInvocation } from '../../../prompts/node/base/promptRenderer';16import { PanelChatBasePrompt } from '../../../prompts/node/panel/panelChatBasePrompt';1718export interface GenericBasePromptElementProps extends BasePromptElementProps {19readonly documentContext?: IDocumentContext;20readonly promptContext: IBuildPromptContext;21}2223export class GenericPanelIntentInvocation extends RendererIntentInvocation implements IIntentInvocation {2425constructor(26intent: IIntent,27location: ChatLocation,28endpoint: IChatEndpoint,29private readonly prompt: PromptElementCtor<GenericBasePromptElementProps, any> = PanelChatBasePrompt,30private readonly documentContext: IDocumentContext | undefined,31@IInstantiationService private readonly instantiationService: IInstantiationService,32) {33super(intent, location, endpoint);34}3536createRenderer(37promptContext: IBuildPromptContext,38endpoint: IChatEndpoint,39progress: vscode.Progress<vscode.ChatResponseReferencePart | vscode.ChatResponseProgressPart>,40token: vscode.CancellationToken41) {42return PromptRenderer.create(this.instantiationService, endpoint, this.prompt, {43documentContext: this.documentContext,44promptContext45});46}47}484950