diff --git a/backend/routes/chatRoutes.js b/backend/routes/chatRoutes.js index 6c98190..e13d072 100644 --- a/backend/routes/chatRoutes.js +++ b/backend/routes/chatRoutes.js @@ -24,6 +24,10 @@ router.post("/", async (req, res) => { return res.status(400).json({ error: "Message is required." }); } + if (message.length > 1000) { + return res.status(400).json({ error: "Message exceeds maximum length of 1000 characters." }); + } + // Format the history for Groq const messages = [ { role: "system", content: SYSTEM_PROMPT }