mirror of
https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git
synced 2026-02-06 16:20:08 +00:00
Apply same fix to extra tags
Count now defaults to max safe integer, which simplifies the sort function Before, it resulted in really bad performance
This commit is contained in:
@@ -23,7 +23,7 @@ class AutocompleteResult {
|
||||
|
||||
// Additional info, only used in some cases
|
||||
category = null;
|
||||
count = null;
|
||||
count = Number.MAX_SAFE_INTEGER;
|
||||
usageBias = null;
|
||||
aliases = null;
|
||||
meta = null;
|
||||
|
||||
@@ -747,7 +747,7 @@ function addResultsToList(textArea, results, tagword, resetList) {
|
||||
}
|
||||
|
||||
// Post count
|
||||
if (result.count && !isNaN(result.count)) {
|
||||
if (result.count && !isNaN(result.count) && result.count !== Number.MAX_SAFE_INTEGER) {
|
||||
let postCount = result.count;
|
||||
let formatter;
|
||||
|
||||
@@ -1158,14 +1158,8 @@ async function autocomplete(textArea, prompt, fixedTag = null) {
|
||||
const aUseStats = counts.find(c => c.name === aName && c.type === a.type);
|
||||
const bUseStats = counts.find(c => c.name === bName && c.type === b.type);
|
||||
|
||||
let aNoCountFallback = 0;
|
||||
let bNoCountFallback = 0;
|
||||
if (TAC_CFG.includeEmbeddingsInNormalResults) {
|
||||
aNoCountFallback = a.type === ResultType.embedding ? Infinity : 0;
|
||||
bNoCountFallback = b.type === ResultType.embedding ? Infinity : 0;
|
||||
}
|
||||
const aWeight = calculateUsageBias(a.count || aNoCountFallback, aUseStats ? aUseStats.count : 0);
|
||||
const bWeight = calculateUsageBias(b.count || bNoCountFallback, bUseStats ? bUseStats.count : 0);
|
||||
const aWeight = calculateUsageBias(a.count, aUseStats ? aUseStats.count : 0);
|
||||
const bWeight = calculateUsageBias(b.count, bUseStats ? bUseStats.count : 0);
|
||||
|
||||
return bWeight - aWeight;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user