Join searched messages by linebreak to avoid searching for implicit whitespace.

This commit is contained in:
Murad "Gness Erquint" Beybalaev
2025-03-19 18:38:05 +03:00
committed by GitHub
parent 35fa634f1d
commit d48ebdb0d4

View File

@@ -785,7 +785,7 @@ router.post('/search', validateAvatarUrlMiddleware, function (request, response)
// Search through chats
const fragments = query.trim().toLowerCase().split(/\s+/).filter(x => x);
const text = messages.map(message => message?.mes).join('').toLowerCase();
const text = messages.map(message => message?.mes).join("\n").toLowerCase();
const stem = chatFile.path.toLowerCase().split(/[\\\/]/).pop().replace(/.jsonl$/, '');
const hasMatch = fragments.every(fragment => (stem + text).includes(fragment));