mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
fix: update preview versions keys for consistency in state management, fixes #406
This commit is contained in:
@@ -216,13 +216,6 @@ function handleCardClick(card, modelType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function showModelModalFromCard(card, modelType) {
|
async function showModelModalFromCard(card, modelType) {
|
||||||
// Get the appropriate preview versions map
|
|
||||||
const previewVersionsKey = modelType;
|
|
||||||
const previewVersions = state.pages[previewVersionsKey]?.previewVersions || new Map();
|
|
||||||
const version = previewVersions.get(card.dataset.filepath);
|
|
||||||
const previewUrl = card.dataset.preview_url || '/loras_static/images/no-preview.png';
|
|
||||||
const versionedPreviewUrl = version ? `${previewUrl}?t=${version}` : previewUrl;
|
|
||||||
|
|
||||||
// Create model metadata object
|
// Create model metadata object
|
||||||
const modelMeta = {
|
const modelMeta = {
|
||||||
sha256: card.dataset.sha256,
|
sha256: card.dataset.sha256,
|
||||||
@@ -235,7 +228,6 @@ async function showModelModalFromCard(card, modelType) {
|
|||||||
from_civitai: card.dataset.from_civitai === 'true',
|
from_civitai: card.dataset.from_civitai === 'true',
|
||||||
base_model: card.dataset.base_model,
|
base_model: card.dataset.base_model,
|
||||||
notes: card.dataset.notes || '',
|
notes: card.dataset.notes || '',
|
||||||
preview_url: versionedPreviewUrl,
|
|
||||||
favorite: card.dataset.favorite === 'true',
|
favorite: card.dataset.favorite === 'true',
|
||||||
// Parse civitai metadata from the card's dataset
|
// Parse civitai metadata from the card's dataset
|
||||||
civitai: JSON.parse(card.dataset.meta || '{}'),
|
civitai: JSON.parse(card.dataset.meta || '{}'),
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ const savedSettings = getStorageItem('settings', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Load preview versions from localStorage for each model type
|
// Load preview versions from localStorage for each model type
|
||||||
const loraPreviewVersions = getMapFromStorage('lora_preview_versions');
|
const loraPreviewVersions = getMapFromStorage('loras_preview_versions');
|
||||||
const checkpointPreviewVersions = getMapFromStorage('checkpoint_preview_versions');
|
const checkpointPreviewVersions = getMapFromStorage('checkpoints_preview_versions');
|
||||||
const embeddingPreviewVersions = getMapFromStorage('embedding_preview_versions');
|
const embeddingPreviewVersions = getMapFromStorage('embeddings_preview_versions');
|
||||||
|
|
||||||
export const state = {
|
export const state = {
|
||||||
// Global state
|
// Global state
|
||||||
|
|||||||
Reference in New Issue
Block a user