File size: 698 Bytes
34097e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// 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,
    "hypernetwork": 7,
    "lora": 8,
    "lyco": 9
});

// 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 = null;
    aliases = null;
    meta = null;

    // Constructor
    constructor(text, type) {
        this.text = text;
        this.type = type;
    }
}