| 783 | continue; | 783 | continue; |
| 784 | } | 784 | } |
| 785 | | 785 | |
| 786 | // Search through messages | 786 | // Search through chats |
| 787 | const fragments = query.trim().toLowerCase().split(/\s+/).filter(x => x); | 787 | const fragments = query.trim().toLowerCase().split(/\s+/).filter(x => x); |
| 788 | const hasMatch = messages.some(message => { | 788 | const text = messages.map(message => message?.mes).join('').toLowerCase(); |
| 789 | const text = message?.mes?.toLowerCase(); | 789 | const stem = chatFile.path.toLowerCase().split(/[\\\/]/).pop().replace(/.jsonl$/, ''); |
| 790 | return text && fragments.every(fragment => text.includes(fragment)); | 790 | const hasMatch = fragments.every(fragment => (stem + text).includes(fragment)); |
| 791 | }); | | |
| 792 | | 791 | |
| 793 | if (hasMatch) { | 792 | if (hasMatch) { |
| 794 | results.push({ | 793 | results.push({ |