mirror of
https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git
synced 2026-01-26 11:09:54 +00:00
- Now stays isolated to tag/alias/translation and also only matches inside one alias at a time - Limited intraIns to 10, should still be enough for most cases while fixing extreme outliers - Added unicode search variant in preparation for translations
42 lines
912 B
JavaScript
42 lines
912 B
JavaScript
// Result data type for cleaner use of optional completion result properties
|
|
|
|
// Type enum
|
|
const ResultType = Object.freeze({
|
|
"tag": 1,
|
|
"extra": 2,
|
|
"embedding": 3,
|
|
"wildcardTag": 4,
|
|
"wildcardFile": 5,
|
|
"yamlWildcard": 6,
|
|
"umiWildcard": 7,
|
|
"hypernetwork": 8,
|
|
"lora": 9,
|
|
"lyco": 10,
|
|
"chant": 11,
|
|
"styleName": 12
|
|
});
|
|
|
|
// Class to hold result data and annotations to make it clearer to use
|
|
class AutocompleteResult {
|
|
// Main properties
|
|
text = "";
|
|
type = ResultType.tag;
|
|
|
|
// Additional info, only used in some cases
|
|
category = null;
|
|
count = Number.MAX_SAFE_INTEGER;
|
|
usageBias = null;
|
|
aliases = null;
|
|
meta = null;
|
|
hash = null;
|
|
sortKey = null;
|
|
// uFuzzy specific
|
|
highlightedText = null;
|
|
matchSource = null;
|
|
|
|
// Constructor
|
|
constructor(text, type) {
|
|
this.text = text;
|
|
this.type = type;
|
|
}
|
|
} |