mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-20 18:51:26 -03:00
feat(recipes): show the recipe base model in the modal header
Adds a base model pill at the front of the recipe modal's tags row, showing the full base model name (cards keep the abbreviation since their overlay width is constrained). Falls back to a dimmed Unknown so the header layout does not shift when hydration fills the value in. Hydration now also merges base_model. Translated in all 9 locales.
This commit is contained in:
@@ -494,6 +494,7 @@ class RecipeModal {
|
||||
this.syncGenerationParams(hydratedRecipe.gen_params);
|
||||
this.syncResourcesSection(hydratedRecipe);
|
||||
this.syncHeaderActions();
|
||||
this.syncBaseModelBadge();
|
||||
this.syncMetaFooter();
|
||||
|
||||
// Show the modal
|
||||
@@ -520,6 +521,32 @@ class RecipeModal {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the recipe-level base model badge in the header tags row.
|
||||
* Unlike the width-constrained card overlay (which abbreviates), the
|
||||
* modal has room for the full base model name — matching the model
|
||||
* modal's info grid and this modal's resource rows. Falls back to a
|
||||
* dimmed "Unknown" instead of hiding so the header layout does not
|
||||
* shift when hydration fills the value in.
|
||||
*/
|
||||
syncBaseModelBadge() {
|
||||
const badge = document.getElementById('recipeBaseModelBadge');
|
||||
if (!badge) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rawLabel = (this.currentRecipe?.base_model || '').trim();
|
||||
const unknownLabel = translate('recipes.modal.metadata.unknown', {}, 'Unknown');
|
||||
const baseModelLabel = rawLabel || unknownLabel;
|
||||
const fieldLabel = translate('recipes.modal.metadata.baseModel', {}, 'Base Model');
|
||||
|
||||
badge.textContent = baseModelLabel;
|
||||
badge.title = `${fieldLabel}: ${baseModelLabel}`;
|
||||
badge.setAttribute('aria-label', badge.title);
|
||||
badge.classList.toggle('is-unknown', !rawLabel);
|
||||
badge.hidden = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the meta footer: clickable file location (opens the recipe JSON
|
||||
* in the OS file manager) plus the truncated recipe ID with copy button.
|
||||
@@ -661,6 +688,10 @@ class RecipeModal {
|
||||
nextRecipe.has_workflow = fullRecipe.has_workflow;
|
||||
}
|
||||
|
||||
if (fullRecipe.base_model !== undefined) {
|
||||
nextRecipe.base_model = fullRecipe.base_model;
|
||||
}
|
||||
|
||||
if (fullRecipe.checkpoint !== undefined) {
|
||||
nextRecipe.checkpoint = fullRecipe.checkpoint;
|
||||
} else {
|
||||
@@ -718,6 +749,7 @@ class RecipeModal {
|
||||
this.updateSourceUrlDisplay(this.currentRecipe.source_path || '');
|
||||
}
|
||||
this.syncHeaderActions();
|
||||
this.syncBaseModelBadge();
|
||||
this.syncMetaFooter();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user