_result.js 698 B

123456789101112131415161718192021222324252627282930313233
  1. // Result data type for cleaner use of optional completion result properties
  2. // Type enum
  3. const ResultType = Object.freeze({
  4. "tag": 1,
  5. "extra": 2,
  6. "embedding": 3,
  7. "wildcardTag": 4,
  8. "wildcardFile": 5,
  9. "yamlWildcard": 6,
  10. "hypernetwork": 7,
  11. "lora": 8,
  12. "lyco": 9
  13. });
  14. // Class to hold result data and annotations to make it clearer to use
  15. class AutocompleteResult {
  16. // Main properties
  17. text = "";
  18. type = ResultType.tag;
  19. // Additional info, only used in some cases
  20. category = null;
  21. count = null;
  22. aliases = null;
  23. meta = null;
  24. // Constructor
  25. constructor(text, type) {
  26. this.text = text;
  27. this.type = type;
  28. }
  29. }