mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-23 15:37:50 +01:00
Add error handling to group parsing in chat search
This commit is contained in:
parent
36051fa5db
commit
8ef49b40b2
@ -561,11 +561,15 @@ router.post('/search', jsonParser, function (request, response) {
|
|||||||
|
|
||||||
let targetGroup;
|
let targetGroup;
|
||||||
for (const groupFile of groupFiles) {
|
for (const groupFile of groupFiles) {
|
||||||
|
try {
|
||||||
const groupData = JSON.parse(fs.readFileSync(path.join(groupDir, groupFile), 'utf8'));
|
const groupData = JSON.parse(fs.readFileSync(path.join(groupDir, groupFile), 'utf8'));
|
||||||
if (groupData.id === group_id) {
|
if (groupData.id === group_id) {
|
||||||
targetGroup = groupData;
|
targetGroup = groupData;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(groupFile, 'group file is corrupted:', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!targetGroup?.chats) {
|
if (!targetGroup?.chats) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user