refactor: separate mode and support prompts

- Rename customPrompts to customModePrompts for mode-specific prompts
- Add new customSupportPrompts type for support action prompts
- Update types to be more specific (CustomModePrompts and CustomSupportPrompts)
- Fix all related tests and component implementations
This commit is contained in:
sam hoang
2025-01-24 01:46:33 +07:00
parent 085d42873c
commit f86e96d157
13 changed files with 119 additions and 99 deletions

View File

@@ -1,7 +1,7 @@
import {
Mode,
modes,
CustomPrompts,
CustomModePrompts,
PromptComponent,
getRoleDefinition,
defaultModeSlug,
@@ -97,7 +97,7 @@ export const SYSTEM_PROMPT = async (
diffStrategy?: DiffStrategy,
browserViewportSize?: string,
mode: Mode = defaultModeSlug,
customPrompts?: CustomPrompts,
customModePrompts?: CustomModePrompts,
customModes?: ModeConfig[],
globalCustomInstructions?: string,
preferredLanguage?: string,
@@ -115,7 +115,7 @@ export const SYSTEM_PROMPT = async (
}
// Check if it's a custom mode
const promptComponent = getPromptComponent(customPrompts?.[mode])
const promptComponent = getPromptComponent(customModePrompts?.[mode])
// Get full mode config from custom modes or fall back to built-in modes
const currentMode = getModeBySlug(mode, customModes) || modes.find((m) => m.slug === mode) || modes[0]