Skip to content

Commit 6991014

Browse files
fix(prompt): update roleDefinition assignment in generatePrompt
- Swap the order of roleDefinition assignment to prioritize modeConfig’s roleDefinition. - Add optional chaining to modeConfig to safely handle undefined values.
1 parent 3917371 commit 6991014

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/prompts/system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function generatePrompt(
5656

5757
// Get the full mode config to ensure we have the role definition
5858
const modeConfig = getModeBySlug(mode, customModeConfigs) || modes.find((m) => m.slug === mode) || modes[0]
59-
const roleDefinition = promptComponent?.roleDefinition || modeConfig.roleDefinition
59+
const roleDefinition = modeConfig?.roleDefinition || promptComponent?.roleDefinition
6060

6161
const basePrompt = `${roleDefinition}
6262

0 commit comments

Comments
 (0)