Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix+feat: cfgDisabled clamp, rename-clobber, recent-5 + LoRA chips on cards

Adam Eivy00504f35bedf
diff --git a/client/src/components/media/MediaCard.jsx b/client/src/components/media/MediaCard.jsx
index b8be2d3a27..e8d51e548b 100644
--- a/client/src/components/media/MediaCard.jsx
+++ b/client/src/components/media/MediaCard.jsx
@@ -1,5 +1,6 @@
-import { Trash2, Download, Film, Image as ImageIcon, Sparkles, Eye, EyeOff, Maximize2 } from 'lucide-react';
+import { Trash2, Download, Film, Image as ImageIcon, Sparkles, Eye, EyeOff, Maximize2, Wand2 } from 'lucide-react';
import AddToCollectionMenu from './AddToCollectionMenu';
+import { loraDisplayName } from './normalize';
// Single card used everywhere a generated image/video appears in a grid:
// the Image Gen page's recent gallery, the Video Gen page's recent renders,
@@ -66,6 +67,19 @@ export default function MediaCard({
{item.fps && <span className="px-1.5 py-0.5 bg-port-border text-gray-400 rounded">{item.fps}fps</span>}
{item.seed != null && <span className="px-1.5 py-0.5 bg-port-border text-gray-400 rounded">seed {item.seed}</span>}
</div>
+ {Array.isArray(item.loraNames) && item.loraNames.length > 0 && (
+ <div className="flex flex-wrap items-center gap-1 text-[9px]" title={item.loraNames.map(loraDisplayName).join(', ')}>
+ <Wand2 className="w-2.5 h-2.5 text-purple-300 shrink-0" />
+ {item.loraNames.slice(0, 2).map((fn) => (
+ <span key={fn} className="px-1.5 py-0.5 bg-purple-600/20 text-purple-300 rounded truncate max-w-[120px]">
+ {loraDisplayName(fn)}
+ </span>
+ ))}
+ {item.loraNames.length > 2 && (
+ <span className="px-1.5 py-0.5 bg-purple-600/20 text-purple-300 rounded">+{item.loraNames.length - 2}</span>
+ )}
+ </div>
+ )}
{!hideActions && (
<div className="flex flex-wrap gap-1">
{!isVideo && onRemix && (
diff --git a/client/src/components/media/normalize.js b/client/src/components/media/normalize.js
index ae368ef7ef..60e912605d 100644
--- a/client/src/components/media/normalize.js
+++ b/client/src/components/media/normalize.js
@@ -1,6 +1,28 @@
+// Friendly display name for a LoRA basename. The on-disk filenames look like
+// `lora-realstagram-v7.safetensors` — strip the `lora-` prefix, the version
+// suffix (`-v123`), and the extension, then re-spaceify dashes. Idempotent
+// for legacy filenames that don't follow the convention.
+export function loraDisplayName(filename) {
+ if (typeof filename !== 'string' || !filename) return '';
+ return filename
+ .replace(/^lora-/, '')
+ .replace(/\.safetensors$/i, '')
+ .replace(/-v\d+$/, '')
+ .replace(/[-_]+/g, ' ')
+ .trim();
+}
+
// Normalizes raw image-gallery / video-history records into a single shape
// consumed by <MediaCard>. Lets the same card render in any history grid.
export function normalizeImage(i) {
+ // Sidecar field shapes: new gen records use loraFilenames (basenames);
+ // legacy records pre-refactor used loraPaths (absolute paths). Reduce both
+ // to a list of basenames so the card can render the same chip regardless.
+ const fromFilenames = Array.isArray(i.loraFilenames) ? i.loraFilenames : [];
+ const fromPaths = Array.isArray(i.loraPaths)
+ ? i.loraPaths.map((p) => (typeof p === 'string' ? p.split(/[\\/]/).pop() : ''))
+ : [];
+ const loraNames = (fromFilenames.length ? fromFilenames : fromPaths).filter(Boolean);
return {
kind: 'image',
key: `image:${i.filename}`,
@@ -16,6 +38,7 @@ export function normalizeImage(i) {
guidance: i.guidance,
quantize: i.quantize,
seed: i.seed,
+ loraNames,
createdAt: i.createdAt,
hidden: !!i.hidden,
raw: i,
@@ -23,6 +46,11 @@ export function normalizeImage(i) {
}
export function normalizeVideo(v) {
+ const fromFilenames = Array.isArray(v.loraFilenames) ? v.loraFilenames : [];
+ const fromPaths = Array.isArray(v.loraPaths)
+ ? v.loraPaths.map((p) => (typeof p === 'string' ? p.split(/[\\/]/).pop() : ''))
+ : [];
+ const loraNames = (fromFilenames.length ? fromFilenames : fromPaths).filter(Boolean);
return {
kind: 'video',
key: `video:${v.id}`,
@@ -38,6 +66,7 @@ export function normalizeVideo(v) {
fps: v.fps,
stitchedFrom: v.stitchedFrom,
upscaledFrom: v.upscaledFrom,
+ loraNames,
createdAt: v.createdAt,
hidden: !!v.hidden,
raw: v,
diff --git a/client/src/pages/ImageGen.jsx b/client/src/pages/ImageGen.jsx
index f3a4c3556c..23884fbac7 100644
--- a/client/src/pages/ImageGen.jsx
+++ b/client/src/pages/ImageGen.jsx
@@ -1060,13 +1060,13 @@ export default function ImageGen() {
{visibleGallery.length > 0 && (
<div className="bg-port-card border border-port-border rounded-xl p-4 space-y-2">
<div className="flex items-center justify-between">
- <h2 className="text-xs font-medium text-gray-400 uppercase tracking-wide">Recent renders ({Math.min(visibleGallery.length, 6)} of {visibleGallery.length})</h2>
- {visibleGallery.length > 6 && (
+ <h2 className="text-xs font-medium text-gray-400 uppercase tracking-wide">Recent renders ({Math.min(visibleGallery.length, 5)} of {visibleGallery.length})</h2>
+ {visibleGallery.length > 5 && (
<Link to="/media/history" className="text-xs text-port-accent hover:underline">View all →</Link>
)}
</div>
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3">
- {visibleGallery.slice(0, 6).map((img) => {
+ {visibleGallery.slice(0, 5).map((img) => {
const item = normalizeImage(img);
return (
<MediaCard
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsx
index 0d41e0b696..d831dac477 100644
--- a/client/src/pages/VideoGen.jsx
+++ b/client/src/pages/VideoGen.jsx
@@ -1269,13 +1269,13 @@ export default function VideoGen() {
{visibleHistory.length > 0 && (
<div className="bg-port-card border border-port-border rounded-xl p-4 space-y-2">
<div className="flex items-center justify-between">
- <h2 className="text-xs font-medium text-gray-400 uppercase tracking-wide">Recent renders ({Math.min(visibleHistory.length, 6)} of {visibleHistory.length})</h2>
- {visibleHistory.length > 6 && (
+ <h2 className="text-xs font-medium text-gray-400 uppercase tracking-wide">Recent renders ({Math.min(visibleHistory.length, 5)} of {visibleHistory.length})</h2>
+ {visibleHistory.length > 5 && (
<Link to="/media/history" className="text-xs text-port-accent hover:underline">View all →</Link>
)}
</div>
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3">
- {visibleHistory.slice(0, 6).map((v) => {
+ {visibleHistory.slice(0, 5).map((v) => {
const item = normalizeVideo(v);
return (
<MediaCard
diff --git a/server/services/imageGen/local.js b/server/services/imageGen/local.js
index 8ee1066aad..904d1ad2c1 100644
--- a/server/services/imageGen/local.js
+++ b/server/services/imageGen/local.js
@@ -238,10 +238,15 @@ export async function generateImage({ pythonPath, prompt, negativePrompt = '', m
// Step-wise distilled models (Schnell / FLUX.2 Klein / Z-Image-Turbo) ignore
// any guidance scale > 1.0 internally; passing a real value just produces a
// "Guidance scale X is ignored for step-wise distilled models." warning on
- // every render. Pin to 1.0 for those so the runner's diffusers call stays
- // quiet and the sidecar metadata reflects what the model actually used.
+ // every render. Clamp to ≤1.0 (rather than hard-pin to 1.0) so registry
+ // entries that intentionally use 0.0 — e.g. Flux.1 Schnell, where the mflux
+ // runner historically *omits* --guidance entirely on 0 — keep their existing
+ // behavior. The clamp keeps FLUX.2 / Z-Image / ERNIE quiet while leaving
+ // sub-1.0 values (including 0.0) untouched.
const requestedGuidance = guidance != null && guidance !== '' ? Number(guidance) : model.guidance;
- const actualGuidance = model.cfgDisabled ? 1.0 : requestedGuidance;
+ const actualGuidance = model.cfgDisabled
+ ? Math.min(1.0, Number.isFinite(requestedGuidance) ? requestedGuidance : 1.0)
+ : requestedGuidance;
// The new client-side surface sends `loraFilenames` (basenames only); the
// server resolves them against PATHS.loras. `loraPaths` is kept as a
// back-compat input for old gallery sidecars that stored absolute paths
diff --git a/server/services/loras.js b/server/services/loras.js
index e9f01e76c1..4ebfb1bf3f 100644
--- a/server/services/loras.js
+++ b/server/services/loras.js
@@ -246,7 +246,19 @@ const downloadToFile = async (url, destPath, { fetchImpl = fetch, headers = {} ,
{ status: 409, code: 'CIVITAI_ALREADY_INSTALLED' },
);
}
- // EXDEV or similar — fall back to rename (best-effort, not atomic).
+ // EXDEV or similar — fall back to rename. Re-check destPath right before
+ // the rename so a concurrent install that landed between our link attempt
+ // and now can't be silently clobbered (POSIX rename overwrites). Treat
+ // late-arriving dest as CIVITAI_ALREADY_INSTALLED, matching the EEXIST
+ // path above.
+ if (existsSync(destPath)) {
+ await rm(tmpPath, { force: true }).catch(() => {});
+ const basename_ = destPath.split('/').pop();
+ throw new ServerError(
+ `Already installed: ${basename_}. Delete it first or pick a different version.`,
+ { status: 409, code: 'CIVITAI_ALREADY_INSTALLED' },
+ );
+ }
await rename(tmpPath, destPath).catch(async (err) => {
await rm(tmpPath, { force: true }).catch(() => {});
throw err;