mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-06-11 13:19:24 -03:00
feat(embedding): send embedding to workflow + fix copy button format
- Fix copy button on embedding cards to copy 'embedding:folder/name' format - Add send-embedding-to-workflow for Prompt (LoraManager), Text (LoraManager), and CLIPTextEncode nodes, appending embedding code to text content - Extend workflow registry to register text-capable nodes by comfyClass (not generic widget name 'text') to avoid false matches - Add mode parameter to update_node_widget API/event for append support - Fix single/bulk context menus: single shows plain 'Send to Workflow', bulk collapses submenu into direct action for embeddings (append-only)
This commit is contained in:
@@ -51,21 +51,33 @@ export class BulkContextMenu extends BaseContextMenu {
|
||||
reimportMetadataItem.style.display = config.reimportMetadata ? 'flex' : 'none';
|
||||
}
|
||||
|
||||
const isEmbeddings = currentModelType === 'embeddings';
|
||||
if (sendToWorkflowAppendItem) {
|
||||
sendToWorkflowAppendItem.style.display = config.sendToWorkflow ? 'flex' : 'none';
|
||||
}
|
||||
if (sendToWorkflowReplaceItem) {
|
||||
sendToWorkflowReplaceItem.style.display = config.sendToWorkflow ? 'flex' : 'none';
|
||||
sendToWorkflowReplaceItem.style.display = (config.sendToWorkflow && !isEmbeddings) ? 'flex' : 'none';
|
||||
}
|
||||
if (copyAllItem) {
|
||||
copyAllItem.style.display = config.copyAll ? 'flex' : 'none';
|
||||
}
|
||||
|
||||
// Submenu parent visibility
|
||||
// Submenu parent - for embeddings, collapse into a direct item (no replace choice)
|
||||
const sendToWorkflowSubmenu = this.menu.querySelector('[data-has-submenu="send-to-workflow"]');
|
||||
if (sendToWorkflowSubmenu) {
|
||||
const hasWorkflowActions = config.sendToWorkflow || config.copyAll;
|
||||
sendToWorkflowSubmenu.style.display = hasWorkflowActions ? 'flex' : 'none';
|
||||
if (isEmbeddings && config.sendToWorkflow && !config.copyAll) {
|
||||
sendToWorkflowSubmenu.classList.remove('has-submenu');
|
||||
sendToWorkflowSubmenu.removeAttribute('data-has-submenu');
|
||||
sendToWorkflowSubmenu.dataset.action = 'send-to-workflow-append';
|
||||
const arrow = sendToWorkflowSubmenu.querySelector('.submenu-arrow');
|
||||
if (arrow) arrow.style.display = 'none';
|
||||
const submenu = sendToWorkflowSubmenu.querySelector('.context-submenu');
|
||||
if (submenu) submenu.style.display = 'none';
|
||||
sendToWorkflowSubmenu.style.display = 'flex';
|
||||
} else {
|
||||
sendToWorkflowSubmenu.style.display = hasWorkflowActions ? 'flex' : 'none';
|
||||
}
|
||||
}
|
||||
|
||||
if (refreshAllItem) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { ModelContextMenuMixin } from './ModelContextMenuMixin.js';
|
||||
import { getModelApiClient, resetAndReload } from '../../api/modelApiFactory.js';
|
||||
import { moveManager } from '../../managers/MoveManager.js';
|
||||
import { showDeleteModal, showExcludeModal } from '../../utils/modalUtils.js';
|
||||
import { sendEmbeddingToWorkflow } from '../../utils/uiHelpers.js';
|
||||
|
||||
export class EmbeddingContextMenu extends BaseContextMenu {
|
||||
constructor() {
|
||||
@@ -51,6 +52,13 @@ export class EmbeddingContextMenu extends BaseContextMenu {
|
||||
this.currentCard.querySelector('.fa-copy').click();
|
||||
}
|
||||
break;
|
||||
case 'sendtoworkflow': {
|
||||
const folder = this.currentCard.dataset.folder || '';
|
||||
const name = this.currentCard.dataset.file_name || '';
|
||||
const embeddingCode = folder ? `embedding:${folder}/${name}` : `embedding:${name}`;
|
||||
sendEmbeddingToWorkflow(embeddingCode, false);
|
||||
break;
|
||||
}
|
||||
case 'refresh-metadata':
|
||||
// Refresh metadata from CivitAI
|
||||
apiClient.refreshSingleModelMetadata(this.currentCard.dataset.filepath);
|
||||
|
||||
Reference in New Issue
Block a user