diff --git a/packages/orchestration-service/src/routes/settings.js b/packages/orchestration-service/src/routes/settings.js index 4a5ba13..3a1055c 100644 --- a/packages/orchestration-service/src/routes/settings.js +++ b/packages/orchestration-service/src/routes/settings.js @@ -34,16 +34,23 @@ router.patch('/', (req, res) => { } if (req.body.modelsFolderPath !== undefined) { - const val = req.body.modelsFolderPath.trim(); - if (!val) return res.status(400).json({ error: 'modelsFolderPath cannot be empty' }); - // Verify the path exists and is readable - try { - fs.readdirSync(val); - } catch { - return res.status(400).json({ error: `Path not accessible: ${val}` }); + const val = req.body.modelsFolderPath.trim(); + if (!val) return res.status(400).json({ error: 'modelsFolderPath cannot be empty' }); + // Verify the path exists and is readable + try { + fs.readdirSync(val); + } catch { + return res.status(400).json({ error: `Path not accessible: ${val}` }); + } + updates.modelsFolderPath = val; + } + + if (req.body.temperature !== undefined) { + const val = Number(req.body.temperature); + if (isNaN(val) || val < 0 || val > 2) + return res.status(400).json({ error: 'temperature must be 0–2' }); + updates.temperature = val; } - updates.modelsFolderPath = val; -} res.json(settings.save(updates)); });