mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 23:25:43 -03:00
refactor: add embedding scanner support in download manager and example images processor
This commit is contained in:
@@ -214,6 +214,10 @@ class DownloadManager:
|
|||||||
if 'checkpoint' in model_types:
|
if 'checkpoint' in model_types:
|
||||||
checkpoint_scanner = await ServiceRegistry.get_checkpoint_scanner()
|
checkpoint_scanner = await ServiceRegistry.get_checkpoint_scanner()
|
||||||
scanners.append(('checkpoint', checkpoint_scanner))
|
scanners.append(('checkpoint', checkpoint_scanner))
|
||||||
|
|
||||||
|
if 'embedding' in model_types:
|
||||||
|
embedding_scanner = await ServiceRegistry.get_embedding_scanner()
|
||||||
|
scanners.append(('embedding', embedding_scanner))
|
||||||
|
|
||||||
# Get all models
|
# Get all models
|
||||||
all_models = []
|
all_models = []
|
||||||
|
|||||||
@@ -251,12 +251,13 @@ class ExampleImagesProcessor:
|
|||||||
# Find the model and get current metadata
|
# Find the model and get current metadata
|
||||||
lora_scanner = await ServiceRegistry.get_lora_scanner()
|
lora_scanner = await ServiceRegistry.get_lora_scanner()
|
||||||
checkpoint_scanner = await ServiceRegistry.get_checkpoint_scanner()
|
checkpoint_scanner = await ServiceRegistry.get_checkpoint_scanner()
|
||||||
|
embedding_scanner = await ServiceRegistry.get_embedding_scanner()
|
||||||
|
|
||||||
model_data = None
|
model_data = None
|
||||||
scanner = None
|
scanner = None
|
||||||
|
|
||||||
# Check both scanners to find the model
|
# Check both scanners to find the model
|
||||||
for scan_obj in [lora_scanner, checkpoint_scanner]:
|
for scan_obj in [lora_scanner, checkpoint_scanner, embedding_scanner]:
|
||||||
cache = await scan_obj.get_cached_data()
|
cache = await scan_obj.get_cached_data()
|
||||||
for item in cache.raw_data:
|
for item in cache.raw_data:
|
||||||
if item.get('sha256') == model_hash:
|
if item.get('sha256') == model_hash:
|
||||||
@@ -384,12 +385,13 @@ class ExampleImagesProcessor:
|
|||||||
# Find the model and get current metadata
|
# Find the model and get current metadata
|
||||||
lora_scanner = await ServiceRegistry.get_lora_scanner()
|
lora_scanner = await ServiceRegistry.get_lora_scanner()
|
||||||
checkpoint_scanner = await ServiceRegistry.get_checkpoint_scanner()
|
checkpoint_scanner = await ServiceRegistry.get_checkpoint_scanner()
|
||||||
|
embedding_scanner = await ServiceRegistry.get_embedding_scanner()
|
||||||
|
|
||||||
model_data = None
|
model_data = None
|
||||||
scanner = None
|
scanner = None
|
||||||
|
|
||||||
# Check both scanners to find the model
|
# Check both scanners to find the model
|
||||||
for scan_obj in [lora_scanner, checkpoint_scanner]:
|
for scan_obj in [lora_scanner, checkpoint_scanner, embedding_scanner]:
|
||||||
if scan_obj.has_hash(model_hash):
|
if scan_obj.has_hash(model_hash):
|
||||||
cache = await scan_obj.get_cached_data()
|
cache = await scan_obj.get_cached_data()
|
||||||
for item in cache.raw_data:
|
for item in cache.raw_data:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { showToast, openCivitai, copyToClipboard, sendLoraToWorkflow, openExampleImagesFolder } from '../../utils/uiHelpers.js';
|
import { showToast, openCivitai, copyToClipboard, sendLoraToWorkflow, openExampleImagesFolder } from '../../utils/uiHelpers.js';
|
||||||
import { state, getCurrentPageState } from '../../state/index.js';
|
import { state, getCurrentPageState } from '../../state/index.js';
|
||||||
import { showModelModal } from './ModelModal.js';
|
import { showModelModal } from './ModelModal.js';
|
||||||
|
import { toggleShowcase } from './showcase/ShowcaseView.js';
|
||||||
import { bulkManager } from '../../managers/BulkManager.js';
|
import { bulkManager } from '../../managers/BulkManager.js';
|
||||||
import { modalManager } from '../../managers/ModalManager.js';
|
import { modalManager } from '../../managers/ModalManager.js';
|
||||||
import { NSFW_LEVELS } from '../../utils/constants.js';
|
import { NSFW_LEVELS } from '../../utils/constants.js';
|
||||||
@@ -281,7 +282,7 @@ function showExampleAccessModal(card, modelType) {
|
|||||||
if (settingsModal) {
|
if (settingsModal) {
|
||||||
modalManager.showModal('settingsModal');
|
modalManager.showModal('settingsModal');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const exampleSection = settingsModal.querySelector('.settings-section:nth-child(5)');
|
const exampleSection = settingsModal.querySelector('.settings-section:nth-child(7)');
|
||||||
if (exampleSection) {
|
if (exampleSection) {
|
||||||
exampleSection.scrollIntoView({ behavior: 'smooth' });
|
exampleSection.scrollIntoView({ behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
@@ -344,7 +345,7 @@ function showExampleAccessModal(card, modelType) {
|
|||||||
if (carousel && carousel.classList.contains('collapsed')) {
|
if (carousel && carousel.classList.contains('collapsed')) {
|
||||||
const scrollIndicator = showcaseTab.querySelector('.scroll-indicator');
|
const scrollIndicator = showcaseTab.querySelector('.scroll-indicator');
|
||||||
if (scrollIndicator) {
|
if (scrollIndicator) {
|
||||||
scrollIndicator.click();
|
toggleShowcase(scrollIndicator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ class ExampleImagesManager {
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
output_dir: outputDir,
|
output_dir: outputDir,
|
||||||
optimize: optimize,
|
optimize: optimize,
|
||||||
model_types: ['lora', 'checkpoint']
|
model_types: ['lora', 'checkpoint', 'embedding'] // Example types, adjust as needed
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user