Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/shared/modes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,14 @@ export function findModeBySlug(slug: string, modes: readonly ModeConfig[] | unde
* If neither is found, the default mode is used.
*/
export function getModeSelection(mode: string, promptComponent?: PromptComponent, customModes?: ModeConfig[]) {
const customMode = findModeBySlug(mode, customModes)
const builtInMode = findModeBySlug(mode, modes)

const modeToUse = customMode || promptComponent || builtInMode

const roleDefinition = modeToUse?.roleDefinition || ""
const baseInstructions = modeToUse?.customInstructions || ""
const modeToUse =
findModeBySlug(mode, customModes) ||
(promptComponent?.roleDefinition ? promptComponent : undefined) ||
findModeBySlug(mode, modes)

return {
roleDefinition,
baseInstructions,
roleDefinition: modeToUse?.roleDefinition || "",
baseInstructions: modeToUse?.customInstructions || "",
}
}

Expand Down