mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
refactor: enhance recipe fingerprint calculation and return detailed recipe information; remove unnecessary console logs in import managers
This commit is contained in:
@@ -824,7 +824,7 @@ class RecipeScanner:
|
|||||||
fingerprint: The recipe fingerprint to search for
|
fingerprint: The recipe fingerprint to search for
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
List of recipe IDs that match the fingerprint
|
List of recipe details that match the fingerprint
|
||||||
"""
|
"""
|
||||||
if not fingerprint:
|
if not fingerprint:
|
||||||
return []
|
return []
|
||||||
@@ -836,7 +836,15 @@ class RecipeScanner:
|
|||||||
matching_recipes = []
|
matching_recipes = []
|
||||||
for recipe in cache.raw_data:
|
for recipe in cache.raw_data:
|
||||||
if recipe.get('fingerprint') == fingerprint:
|
if recipe.get('fingerprint') == fingerprint:
|
||||||
matching_recipes.append(recipe.get('id'))
|
recipe_details = {
|
||||||
|
'id': recipe.get('id'),
|
||||||
|
'title': recipe.get('title'),
|
||||||
|
'file_url': self._format_file_url(recipe.get('file_path')),
|
||||||
|
'modified': recipe.get('modified'),
|
||||||
|
'created_date': recipe.get('created_date'),
|
||||||
|
'lora_count': len(recipe.get('loras', []))
|
||||||
|
}
|
||||||
|
matching_recipes.append(recipe_details)
|
||||||
|
|
||||||
return matching_recipes
|
return matching_recipes
|
||||||
|
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ def calculate_recipe_fingerprint(loras):
|
|||||||
if not hash_value:
|
if not hash_value:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Normalize strength to 2 decimal places
|
# Normalize strength to 2 decimal places (check both strength and weight fields)
|
||||||
strength = round(float(lora.get("strength", 1.0)), 2)
|
strength = round(float(lora.get("strength", lora.get("weight", 1.0))), 2)
|
||||||
|
|
||||||
valid_loras.append((hash_value, strength))
|
valid_loras.append((hash_value, strength))
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ export class DownloadManager {
|
|||||||
// Add source_path to metadata to track where the recipe was imported from
|
// Add source_path to metadata to track where the recipe was imported from
|
||||||
if (this.importManager.importMode === 'url') {
|
if (this.importManager.importMode === 'url') {
|
||||||
const urlInput = document.getElementById('imageUrlInput');
|
const urlInput = document.getElementById('imageUrlInput');
|
||||||
console.log("urlInput.value", urlInput.value);
|
|
||||||
if (urlInput && urlInput.value) {
|
if (urlInput && urlInput.value) {
|
||||||
completeMetadata.source_path = urlInput.value;
|
completeMetadata.source_path = urlInput.value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,8 +170,6 @@ export class ImageProcessor {
|
|||||||
// Get recipe data from response
|
// Get recipe data from response
|
||||||
this.importManager.recipeData = await response.json();
|
this.importManager.recipeData = await response.json();
|
||||||
|
|
||||||
console.log('Recipe data:', this.importManager.recipeData);
|
|
||||||
|
|
||||||
// Check if we have an error message
|
// Check if we have an error message
|
||||||
if (this.importManager.recipeData.error) {
|
if (this.importManager.recipeData.error) {
|
||||||
throw new Error(this.importManager.recipeData.error);
|
throw new Error(this.importManager.recipeData.error);
|
||||||
@@ -184,11 +182,6 @@ export class ImageProcessor {
|
|||||||
throw new Error('No LoRA information found in this image');
|
throw new Error('No LoRA information found in this image');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store generation parameters if available
|
|
||||||
if (this.importManager.recipeData.gen_params) {
|
|
||||||
console.log('Generation parameters found:', this.importManager.recipeData.gen_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find missing LoRAs
|
// Find missing LoRAs
|
||||||
this.importManager.missingLoras = this.importManager.recipeData.loras.filter(
|
this.importManager.missingLoras = this.importManager.recipeData.loras.filter(
|
||||||
lora => !lora.existsLocally
|
lora => !lora.existsLocally
|
||||||
|
|||||||
Reference in New Issue
Block a user