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

@@ -18,8 +18,8 @@ export type PromptComponent = {
customInstructions?: string
}
export type CustomPrompts = {
[key: string]: PromptComponent | undefined | string
export type CustomModePrompts = {
[key: string]: PromptComponent | undefined
}
// Helper to get all tools for a mode
@@ -141,7 +141,7 @@ export function isToolAllowedForMode(
}
// Create the mode-specific default prompts
export const defaultPrompts: Readonly<CustomPrompts> = Object.freeze(
export const defaultPrompts: Readonly<CustomModePrompts> = Object.freeze(
Object.fromEntries(modes.map((mode) => [mode.slug, { roleDefinition: mode.roleDefinition }])),
)