Prepend title to chat messages array before concatenating the string.

This commit is contained in:
Gness Erquint
2025-03-19 19:40:28 +03:00
parent d48ebdb0d4
commit bbdd98a155

View File

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