mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-26 15:38:52 -03:00
Refactor Lora handling in RecipeRoutes and enhance RecipeManager
- Updated Lora filtering logic in RecipeRoutes to skip deleted LoRAs without exclusion checks, improving performance and clarity. - Enhanced condition for fetching cached LoRAs to ensure valid data is processed. - Added toggleApiKeyVisibility function to RecipeManager, improving API key management in the UI.
This commit is contained in:
@@ -943,7 +943,10 @@ class RecipeRoutes:
|
|||||||
|
|
||||||
for lora in loras:
|
for lora in loras:
|
||||||
# Skip loras that are deleted AND marked for exclusion
|
# Skip loras that are deleted AND marked for exclusion
|
||||||
if lora.get("isDeleted", False) and lora.get("exclude", False):
|
if lora.get("isDeleted", False):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not self.recipe_scanner._lora_scanner.has_lora_hash(lora.get("hash", "")):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Get the strength
|
# Get the strength
|
||||||
@@ -966,7 +969,9 @@ class RecipeRoutes:
|
|||||||
# Search for files with matching modelVersionId
|
# Search for files with matching modelVersionId
|
||||||
all_loras = await self.recipe_scanner._lora_scanner.get_cached_data()
|
all_loras = await self.recipe_scanner._lora_scanner.get_cached_data()
|
||||||
for cached_lora in all_loras.raw_data:
|
for cached_lora in all_loras.raw_data:
|
||||||
if "civitai" in cached_lora and cached_lora["civitai"].get("id") == lora.get("modelVersionId"):
|
if not cached_lora.get("civitai"):
|
||||||
|
continue
|
||||||
|
if cached_lora.get("civitai", {}).get("id") == lora.get("modelVersionId"):
|
||||||
file_name = os.path.splitext(os.path.basename(cached_lora["path"]))[0]
|
file_name = os.path.splitext(os.path.basename(cached_lora["path"]))[0]
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { ImportManager } from './managers/ImportManager.js';
|
|||||||
import { RecipeCard } from './components/RecipeCard.js';
|
import { RecipeCard } from './components/RecipeCard.js';
|
||||||
import { RecipeModal } from './components/RecipeModal.js';
|
import { RecipeModal } from './components/RecipeModal.js';
|
||||||
import { getCurrentPageState } from './state/index.js';
|
import { getCurrentPageState } from './state/index.js';
|
||||||
|
import { toggleApiKeyVisibility } from './managers/SettingsManager.js';
|
||||||
|
|
||||||
class RecipeManager {
|
class RecipeManager {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -54,6 +55,7 @@ class RecipeManager {
|
|||||||
// Only expose what's needed for the page
|
// Only expose what's needed for the page
|
||||||
window.recipeManager = this;
|
window.recipeManager = this;
|
||||||
window.importManager = this.importManager;
|
window.importManager = this.importManager;
|
||||||
|
window.toggleApiKeyVisibility = toggleApiKeyVisibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
initEventListeners() {
|
initEventListeners() {
|
||||||
|
|||||||
Reference in New Issue
Block a user