Merge pull request #3727 from Erquint/staging
Chat titles are now included in the search. Query terms don't have to occur in the same message anymore.
This commit is contained in:
@@ -783,12 +783,11 @@ router.post('/search', validateAvatarUrlMiddleware, function (request, response)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Search through messages
|
||||
// Search through title and messages of the chat
|
||||
const fragments = query.trim().toLowerCase().split(/\s+/).filter(x => x);
|
||||
const hasMatch = messages.some(message => {
|
||||
const text = message?.mes?.toLowerCase();
|
||||
return text && 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({
|
||||
|
||||
Reference in New Issue
Block a user