Skip to content
Merged
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
5 changes: 5 additions & 0 deletions backend/src/routes/chatModes.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@ router.get('/chat-modes', async (req, res) => {
* GET /api/chat-modes/:modeId
* Returns a specific chat mode configuration
*/
const VALID_MODE_ID = /^[a-z0-9][a-z0-9-]{0,63}$/

router.get('/chat-modes/:modeId', async (req, res) => {
try {
const { modeId } = req.params
if (!VALID_MODE_ID.test(modeId)) {
return res.status(400).json({ error: 'Invalid mode id' })
}
const filePath = path.join(PROMPTS_DIR, `${modeId}.json`)

const mode = await loadModeConfig(filePath)
Expand Down
Loading