mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-05-06 16:36:45 -03:00
fix(autocomplete): improve wildcard onboarding UX
This commit is contained in:
@@ -2,6 +2,11 @@ export const WILDCARD_COMMANDS = {
|
||||
'/wildcard': { type: 'wildcard', label: 'Wildcards' },
|
||||
};
|
||||
|
||||
export const WILDCARD_INFO_ITEM_TYPES = {
|
||||
EMPTY_STATE: 'wildcard_empty_state',
|
||||
NO_MATCHES: 'wildcard_no_matches',
|
||||
};
|
||||
|
||||
export function isWildcardCommand(command) {
|
||||
return command?.type === 'wildcard';
|
||||
}
|
||||
@@ -17,3 +22,33 @@ export function getWildcardInsertText(relativePath = '') {
|
||||
}
|
||||
return `__${trimmed}__`;
|
||||
}
|
||||
|
||||
export function isWildcardInfoItem(item) {
|
||||
return Boolean(
|
||||
item &&
|
||||
typeof item === 'object' &&
|
||||
Object.values(WILDCARD_INFO_ITEM_TYPES).includes(item.type)
|
||||
);
|
||||
}
|
||||
|
||||
export function createWildcardEmptyStateItem(meta = {}) {
|
||||
return {
|
||||
type: WILDCARD_INFO_ITEM_TYPES.EMPTY_STATE,
|
||||
title: 'No wildcards found yet',
|
||||
description: 'Create wildcard files in your wildcards folder, then use /wildcard to search and insert keys.',
|
||||
wildcardsDir: meta.wildcards_dir || '',
|
||||
supportedFormats: Array.isArray(meta.supported_formats) ? meta.supported_formats : [],
|
||||
};
|
||||
}
|
||||
|
||||
export function createWildcardNoMatchesItem(searchTerm = '', meta = {}) {
|
||||
return {
|
||||
type: WILDCARD_INFO_ITEM_TYPES.NO_MATCHES,
|
||||
title: 'No wildcard matches',
|
||||
description: searchTerm
|
||||
? `No wildcard keys matched "${searchTerm}".`
|
||||
: 'No wildcard keys matched your search.',
|
||||
wildcardsDir: meta.wildcards_dir || '',
|
||||
supportedFormats: Array.isArray(meta.supported_formats) ? meta.supported_formats : [],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user