mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
feat: simplify model ID parsing and loading manager usage
This commit is contained in:
@@ -262,15 +262,10 @@ export const ModelContextMenuMixin = {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const directValue = this.parseModelId(card.dataset?.modelId);
|
|
||||||
if (directValue !== null) {
|
|
||||||
return directValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (card.dataset?.meta) {
|
if (card.dataset?.meta) {
|
||||||
try {
|
try {
|
||||||
const meta = JSON.parse(card.dataset.meta);
|
const meta = JSON.parse(card.dataset.meta);
|
||||||
const metaValue = this.parseModelId(meta?.modelId ?? meta?.model_id);
|
const metaValue = this.parseModelId(meta?.modelId);
|
||||||
if (metaValue !== null) {
|
if (metaValue !== null) {
|
||||||
return metaValue;
|
return metaValue;
|
||||||
}
|
}
|
||||||
@@ -298,18 +293,13 @@ export const ModelContextMenuMixin = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = getModelApiClient();
|
const apiClient = getModelApiClient();
|
||||||
if (!apiClient || typeof apiClient.refreshUpdatesForModels !== 'function') {
|
|
||||||
console.warn('Model API client does not support refreshUpdatesForModels');
|
|
||||||
showToast('toast.models.bulkUpdatesFailed', { type: typeLabel, message: 'Operation not supported' }, 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const loadingMessage = translate(
|
const loadingMessage = translate(
|
||||||
'toast.models.bulkUpdatesChecking',
|
'toast.models.bulkUpdatesChecking',
|
||||||
{ count: 1, type: typeLabel },
|
{ count: 1, type: typeLabel },
|
||||||
`Checking selected ${typeLabel}(s) for updates...`
|
`Checking selected ${typeLabel}(s) for updates...`
|
||||||
);
|
);
|
||||||
state.loadingManager?.showSimpleLoading?.(loadingMessage);
|
state.loadingManager.showSimpleLoading(loadingMessage);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await apiClient.refreshUpdatesForModels([modelId]);
|
const response = await apiClient.refreshUpdatesForModels([modelId]);
|
||||||
@@ -334,12 +324,8 @@ export const ModelContextMenuMixin = {
|
|||||||
'error'
|
'error'
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
if (state.loadingManager?.hide) {
|
state.loadingManager.hide();
|
||||||
state.loadingManager.hide();
|
state.loadingManager.restoreProgressBar();
|
||||||
}
|
|
||||||
if (typeof state.loadingManager?.restoreProgressBar === 'function') {
|
|
||||||
state.loadingManager.restoreProgressBar();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user