Path: blob/main/extensions/copilot/src/extension/prompts/node/panel/promptCategorization.tsx
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*--------------------------------------------------------------------------------------------*/45import { BasePromptElementProps, PromptElement, PromptSizing, SystemMessage, UserMessage } from '@vscode/prompt-tsx';6import { generateTaxonomyPrompt } from '../../../prompt/common/promptCategorizationTaxonomy';7import { SafetyRules } from '../base/safetyRules';8import { CurrentEditor } from './currentEditor';9import { WorkspaceStructure } from './workspace/workspaceStructure';1011// Re-export types for consumers12export type { PromptClassification, PromptIntent, PromptDomain, PromptScope } from '../../../prompt/common/promptCategorizationTaxonomy';1314export interface PromptCategorizationProps extends BasePromptElementProps {15userRequest: string;16}1718export class PromptCategorizationPrompt extends PromptElement<PromptCategorizationProps> {19override async render(_state: void, sizing: PromptSizing) {20const systemPrompt = [21'You are an expert classifier for AI coding assistant prompts. Classify developer requests in context of their workspace and active file across domain, intent, time estimate, and scope.',22'You MUST use the categorize_prompt tool to provide your classification.',23generateTaxonomyPrompt(),24].join('\n\n') + '\n\n';2526return (27<>28<SystemMessage priority={1000}>29{systemPrompt}30<SafetyRules />31</SystemMessage>32<UserMessage priority={900}>33<WorkspaceStructure priority={600} flexGrow={0} maxSize={Math.min(300, Math.floor(sizing.tokenBudget * 0.1))} /><br />34<CurrentEditor priority={600} flexGrow={0} /><br />35User message:<br />36{this.props.userRequest}37</UserMessage>38</>39);40}41}424344