mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-23 07:27:41 +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;
|
||||
for (const groupFile of groupFiles) {
|
||||
try {
|
||||
const groupData = JSON.parse(fs.readFileSync(path.join(groupDir, groupFile), 'utf8'));
|
||||
if (groupData.id === group_id) {
|
||||
targetGroup = groupData;
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(groupFile, 'group file is corrupted:', error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!targetGroup?.chats) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user