fix(recipes): resolve stale LoRA hash on import and add hashInvalid state

- import: prefer A1111 Lora hashes (12-char AutoV3) over conflicting Hashes
  JSON values; recover the quote-wrapped AutoV3 from CivitAI image API meta;
  merge EXIF-parsed LoRAs when the API-only parse yields none (meta=null)
- rematch: treat entries whose hash failed CivitAI resolution (hashInvalid)
  as unresolved candidates; clear the flag on rematch/reconnect write-back
- download: persist hashInvalid and show a distinct toast when hash lookup
  returns "Model not found", so unresolvable entries become recoverable
- ui: add Unresolvable Hash badge styling and reconnect affordance
- i18n: translate the new keys across all 10 locales
This commit is contained in:
Will Miao
2026-08-28 22:24:07 +08:00
parent a7d65fe84a
commit 856c9a87ac
24 changed files with 757 additions and 28 deletions
+32 -3
View File
@@ -850,7 +850,8 @@
}
.local-badge,
.missing-badge {
.missing-badge,
.invalid-hash-badge {
position: absolute;
right: 0;
top: 0;
@@ -861,7 +862,8 @@
/* Specific styles for recipe modal badges - update z-index */
.recipe-lora-header .local-badge,
.recipe-lora-header .missing-badge {
.recipe-lora-header .missing-badge,
.recipe-lora-header .invalid-hash-badge {
z-index: 2; /* Ensure the badge is above other elements */
backface-visibility: hidden;
}
@@ -903,6 +905,26 @@
font-size: 0.9em;
}
/* Unresolvable-hash badge: the entry has identity fields, but its hash is
not registered on CivitAI (stale or invalid). */
.invalid-hash-badge {
display: inline-flex;
align-items: center;
background: var(--lora-warning);
color: white;
padding: 3px 6px;
border-radius: var(--border-radius-xs);
font-size: 0.75em;
font-weight: 500;
white-space: nowrap;
flex-shrink: 0;
}
.invalid-hash-badge i {
margin-right: 4px;
font-size: 0.9em;
}
/* Deleted badge is a pure status indicator; the reconnect action lives on
an explicit ghost button in the item's action row. */
@@ -1124,7 +1146,8 @@
/* Badges are pure status indicators; actions live in .recipe-lora-actions */
.badge-container .local-badge,
.badge-container .missing-badge,
.badge-container .deleted-badge {
.badge-container .deleted-badge,
.badge-container .invalid-hash-badge {
position: static; /* Override absolute positioning */
transform: none; /* Remove the transform */
}
@@ -1150,6 +1173,12 @@
border: 1px solid rgba(127, 127, 127, 0.35);
}
.badge-container .invalid-hash-badge {
background: oklch(var(--lora-warning) / 0.14);
color: var(--lora-warning);
border: 1px solid oklch(var(--lora-warning) / 0.35);
}
/* Missing LoRAs status is a real button: the affordance must be visible at
rest (persistent border), not only on hover. */
.recipe-status.missing.clickable {