diff --git a/src/endpoints/chats.js b/src/endpoints/chats.js index fabbcf8bb..9c7376838 100644 --- a/src/endpoints/chats.js +++ b/src/endpoints/chats.js @@ -785,7 +785,7 @@ router.post('/search', validateAvatarUrlMiddleware, function (request, response) // Search through title and messages of the chat const fragments = query.trim().toLowerCase().split(/\s+/).filter(x => x); - const text = [chatFile.path.split(/[\\/]/).pop().replace(/.jsonl$/, ''), + const text = [path.parse(chatFile.path).name, ...messages.map(message => message?.mes)].join('\n').toLowerCase(); const hasMatch = fragments.every(fragment => text.includes(fragment));