Refactor to support more sections in the future

This commit is contained in:
Matt Rubens
2025-01-14 07:55:16 -05:00
parent 75e308b033
commit 092a121a37
12 changed files with 116 additions and 95 deletions

View File

@@ -48,7 +48,7 @@ export interface ExtensionMessage {
mcpServers?: McpServer[]
commits?: GitCommit[]
listApiConfig?: ApiConfigMeta[]
mode?: Mode | 'enhance'
mode?: Mode
}
export interface ApiConfigMeta {

View File

@@ -1,5 +1,5 @@
import { ApiConfiguration, ApiProvider } from "./api"
import { Mode } from "./modes"
import { Mode, PromptComponent } from "./modes"
export type PromptMode = Mode | 'enhance'
@@ -66,6 +66,7 @@ export interface WebviewMessage {
| "setApiConfigPassword"
| "mode"
| "updatePrompt"
| "updateEnhancedPrompt"
| "getSystemPrompt"
| "systemPrompt"
| "enhancementApiConfigId"
@@ -83,7 +84,7 @@ export interface WebviewMessage {
alwaysAllow?: boolean
mode?: Mode
promptMode?: PromptMode
customPrompt?: string
customPrompt?: PromptComponent
dataUrls?: string[]
values?: Record<string, any>
query?: string

View File

@@ -4,16 +4,26 @@ export const askMode = 'ask' as const;
export type Mode = typeof codeMode | typeof architectMode | typeof askMode;
export type PromptComponent = {
roleDefinition?: string;
}
export type CustomPrompts = {
ask?: string;
code?: string;
architect?: string;
ask?: PromptComponent;
code?: PromptComponent;
architect?: PromptComponent;
enhance?: string;
}
export const defaultPrompts = {
[askMode]: "You are Cline, a knowledgeable technical assistant focused on answering questions and providing information about software development, technology, and related topics. You can analyze code, explain concepts, and access external resources while maintaining a read-only approach to the codebase. Make sure to answer the user's questions and don't rush to switch to implementing code.",
[codeMode]: "You are Cline, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.",
[architectMode]: "You are Cline, a software architecture expert specializing in analyzing codebases, identifying patterns, and providing high-level technical guidance. You excel at understanding complex systems, evaluating architectural decisions, and suggesting improvements while maintaining a read-only approach to the codebase. Make sure to help the user come up with a solid implementation plan for their project and don't rush to switch to implementing code.",
[askMode]: {
roleDefinition: "You are Cline, a knowledgeable technical assistant focused on answering questions and providing information about software development, technology, and related topics. You can analyze code, explain concepts, and access external resources while maintaining a read-only approach to the codebase. Make sure to answer the user's questions and don't rush to switch to implementing code.",
},
[codeMode]: {
roleDefinition: "You are Cline, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.",
},
[architectMode]: {
roleDefinition: "You are Cline, a software architecture expert specializing in analyzing codebases, identifying patterns, and providing high-level technical guidance. You excel at understanding complex systems, evaluating architectural decisions, and suggesting improvements while maintaining a read-only approach to the codebase. Make sure to help the user come up with a solid implementation plan for their project and don't rush to switch to implementing code.",
},
enhance: "Generate an enhanced version of this prompt (reply with only the enhanced prompt - no conversation, explanations, lead-in, bullet points, placeholders, or surrounding quotes):"
} as const;