model temperature settings

This commit is contained in:
Storme-bit
2026-04-18 02:54:47 -07:00
parent 616383e9bc
commit 2b47b06563

View File

@@ -34,16 +34,23 @@ router.patch('/', (req, res) => {
} }
if (req.body.modelsFolderPath !== undefined) { if (req.body.modelsFolderPath !== undefined) {
const val = req.body.modelsFolderPath.trim(); const val = req.body.modelsFolderPath.trim();
if (!val) return res.status(400).json({ error: 'modelsFolderPath cannot be empty' }); if (!val) return res.status(400).json({ error: 'modelsFolderPath cannot be empty' });
// Verify the path exists and is readable // Verify the path exists and is readable
try { try {
fs.readdirSync(val); fs.readdirSync(val);
} catch { } catch {
return res.status(400).json({ error: `Path not accessible: ${val}` }); 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 02' });
updates.temperature = val;
} }
updates.modelsFolderPath = val;
}
res.json(settings.save(updates)); res.json(settings.save(updates));
}); });