mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-01 11:56:48 +01:00
Add check for existing chats directory before reading files
This commit is contained in:
parent
abef12d403
commit
6ae296d5b5
@ -1010,6 +1010,11 @@ router.post('/chats', jsonParser, async function (request, response) {
|
||||
|
||||
try {
|
||||
const chatsDirectory = path.join(request.user.directories.chats, characterDirectory);
|
||||
|
||||
if (!fs.existsSync(chatsDirectory)) {
|
||||
return response.send({ error: true });
|
||||
}
|
||||
|
||||
const files = fs.readdirSync(chatsDirectory);
|
||||
const jsonFiles = files.filter(file => path.extname(file) === '.jsonl');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user