This commit is contained in:
Cohee
2025-03-19 19:31:09 +02:00
parent a3c57fb05f
commit d3e62fe56c

View File

@ -785,9 +785,9 @@ 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$/, ''),
...messages.map(message => message?.mes)].join("\n").toLowerCase();
const hasMatch = fragments.every(fragment => (text).includes(fragment));
const text = [chatFile.path.split(/[\\/]/).pop().replace(/.jsonl$/, ''),
...messages.map(message => message?.mes)].join('\n').toLowerCase();
const hasMatch = fragments.every(fragment => text.includes(fragment));
if (hasMatch) {
results.push({