feat(ui): improve starter model search for spandrel models

This commit is contained in:
psychedelicious 2024-07-24 07:31:36 +10:00
parent b4519ea61f
commit 94b5b2a467

View File

@ -19,9 +19,16 @@ export const StarterModelsResults = ({ results }: StarterModelsResultsProps) =>
const filteredResults = useMemo(() => {
return results.filter((result) => {
const trimmedSearchTerm = searchTerm.trim().toLowerCase();
const matchStrings = [result.name.toLowerCase(), result.type.toLowerCase(), result.description.toLowerCase()];
const matchStrings = [
result.name.toLowerCase(),
result.type.toLowerCase().replaceAll('_', ' '),
result.description.toLowerCase(),
];
if (result.type === 'spandrel_image_to_image') {
matchStrings.push('upscale');
matchStrings.push('post-processing');
matchStrings.push('postprocessing');
matchStrings.push('post processing');
}
return matchStrings.some((matchString) => matchString.includes(trimmedSearchTerm));
});