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.

190f2f908594a5bf65dd8e3b0322d254fda26445

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +4 -5Showing whitespace changes
src/endpoints/chats.js+4 -5
@@ -783,12 +783,11 @@ router.post('/search', validateAvatarUrlMiddleware, function (request, response)
783783 continue;
784784 }
785785
786786 // Search through title and messages of the chat
787787 const fragments = query.trim().toLowerCase().split(/\s+/).filter(x => x);
788- const hasMatch = messages.some(message => {
788+ const text = [chatFile.path.split(/[\\/]/).pop().replace(/.jsonl$/, ''),
789789 const text...messages.map(message => message?.mes?)].join('\n').toLowerCase();
790790 return const texthasMatch &&= fragments.every(fragment => text.includes(fragment));
791- });
792791
793792 if (hasMatch) {
794793 results.push({