Fix for embedding search without v1/v2 prefix

This commit is contained in:
Dominik Reh
2023-01-02 00:44:56 +01:00
parent 6deefda279
commit 454c13ef6d

View File

@@ -835,8 +835,10 @@ async function autocomplete(textArea, prompt, fixedTag = null) {
versionString = searchTerm.slice(0, 2);
searchTerm = searchTerm.slice(2);
}
let versionCondition = x => x[1] && x[1] === versionString;
tempResults = embeddings.filter(x => x[0].toLowerCase().includes(searchTerm) && versionCondition(x)); // Filter by tagword
if (versionString)
tempResults = embeddings.filter(x => x[0].toLowerCase().includes(searchTerm) && x[1] && x[1] === versionString); // Filter by tagword
else
tempResults = embeddings.filter(x => x[0].toLowerCase().includes(searchTerm)); // Filter by tagword
} else {
tempResults = embeddings;
}