mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Quick and dirty stat re-creator button
This commit is contained in:
20
server.js
20
server.js
@@ -1297,6 +1297,26 @@ app.post("/getstats", jsonParser, function (request, response) {
|
||||
response.send(JSON.stringify(statsHelpers.getCharStats()));
|
||||
});
|
||||
|
||||
/**
|
||||
* Endpoint: POST /recreatestats
|
||||
*
|
||||
* Triggers the recreation of statistics from chat files.
|
||||
* - If successful: returns a 200 OK status.
|
||||
* - On failure: returns a 500 Internal Server Error status.
|
||||
*
|
||||
* @param {Object} request - Express request object.
|
||||
* @param {Object} response - Express response object.
|
||||
*/
|
||||
app.post("/recreatestats", jsonParser, function (request, response) {
|
||||
if (statsHelpers.loadStatsFile(DIRECTORIES.chats, DIRECTORIES.characters, true)) {
|
||||
return response.sendStatus(200);
|
||||
} else {
|
||||
return response.sendStatus(500);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Handle a POST request to update the stats object
|
||||
*
|
||||
|
Reference in New Issue
Block a user