Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/prompts/node/panel/chroniclePrompt.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 { BasePromptElementProps, PromptElement, SystemMessage, UserMessage } from '@vscode/prompt-tsx';
7
import { SafetyRules } from '../base/safetyRules';
8
import { CopilotIdentityRules } from '../base/copilotIdentity';
9
import { IBuildPromptContext } from '../../../prompt/common/intents';
10
import { IChatEndpoint } from '../../../../platform/networking/common/networking';
11
import { ChatToolCalls } from './toolCalling';
12
13
export interface ChroniclePromptProps extends BasePromptElementProps {
14
promptContext: IBuildPromptContext;
15
endpoint: IChatEndpoint;
16
systemPrompt: string;
17
}
18
19
export class ChroniclePrompt extends PromptElement<ChroniclePromptProps> {
20
render() {
21
const userQuery = this.props.promptContext.query || 'Go ahead.';
22
return (
23
<>
24
<SystemMessage priority={1000}>
25
<CopilotIdentityRules />
26
<SafetyRules />
27
{this.props.systemPrompt}
28
</SystemMessage>
29
<UserMessage priority={900}>{userQuery}</UserMessage>
30
<ChatToolCalls
31
priority={899}
32
flexGrow={2}
33
promptContext={this.props.promptContext}
34
toolCallRounds={this.props.promptContext.toolCallRounds}
35
toolCallResults={this.props.promptContext.toolCallResults}
36
enableCacheBreakpoints={false}
37
/>
38
</>
39
);
40
}
41
}
42
43