Fix OpenAI presets extension

This commit is contained in:
Cohee 2023-12-06 21:46:08 +02:00
parent 64496425cc
commit d0a35deeec

View File

@ -103,7 +103,7 @@ router.post('/save-openai', jsonParser, function (request, response) {
const name = sanitize(request.query.name); const name = sanitize(request.query.name);
if (!name) return response.sendStatus(400); if (!name) return response.sendStatus(400);
const filename = `${name}.settings`; const filename = `${name}.json`;
const fullpath = path.join(DIRECTORIES.openAI_Settings, filename); const fullpath = path.join(DIRECTORIES.openAI_Settings, filename);
writeFileAtomicSync(fullpath, JSON.stringify(request.body, null, 4), 'utf-8'); writeFileAtomicSync(fullpath, JSON.stringify(request.body, null, 4), 'utf-8');
return response.send({ name }); return response.send({ name });
@ -116,7 +116,7 @@ router.post('/delete-openai', jsonParser, function (request, response) {
} }
const name = request.body.name; const name = request.body.name;
const pathToFile = path.join(DIRECTORIES.openAI_Settings, `${name}.settings`); const pathToFile = path.join(DIRECTORIES.openAI_Settings, `${name}.json`);
if (fs.existsSync(pathToFile)) { if (fs.existsSync(pathToFile)) {
fs.rmSync(pathToFile); fs.rmSync(pathToFile);