Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/prompts/node/base/instructionMessage.tsx
13405 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 { PromptElement, PromptPiece, PromptSizing, SystemMessage, UserMessage } from '@vscode/prompt-tsx';
7
import { IPromptEndpoint } from './promptRenderer';
8
import { modelPrefersInstructionsInUserMessage } from '../../../../platform/endpoint/common/chatModelCapabilities';
9
10
export class InstructionMessage extends PromptElement {
11
constructor(props: any, @IPromptEndpoint private readonly promptEndpoint: IPromptEndpoint) {
12
super(props);
13
}
14
override render(_state: void, sizing: PromptSizing): PromptPiece {
15
return modelPrefersInstructionsInUserMessage(this.promptEndpoint.family)
16
? <UserMessage>{this.props.children}</UserMessage>
17
: <SystemMessage>{this.props.children}</SystemMessage>;
18
}
19
}
20
21