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

Image gen no longer applies a default negative prompt (#11061)

[._.]/767e9a0f1f17
diff --git a/client/src/components/QuickImagePrompt.jsx b/client/src/components/QuickImagePrompt.jsx
index f765e84d90..7d3012781b 100644
--- a/client/src/components/QuickImagePrompt.jsx
+++ b/client/src/components/QuickImagePrompt.jsx
@@ -2,7 +2,6 @@ import { useState, useRef, useEffect, useMemo } from 'react';
import { Link, useNavigate } from 'react-router';
import { Sparkles, Pencil, ChevronDown, ChevronRight } from 'lucide-react';
import { generateImage, listUniverseStyles } from '../services/api';
-import { DEFAULT_NEGATIVE_PROMPT } from '../lib/imageGenDefaults';
import { RESOLUTIONS, MAX_IMAGE_EDGE, MAX_IMAGE_PIXELS } from '../lib/imageGenResolutions';
import { composeStyledPrompt } from '../lib/composeStyledPrompt';
import { universeStylePreset } from '../lib/universeStylePreset';
@@ -21,7 +20,7 @@ const QUICK_RESOLUTIONS = RESOLUTIONS.filter((r) => !r.compatible);
export default function QuickImagePrompt() {
const [prompt, setPrompt] = useState('');
- const [negativePrompt, setNegativePrompt] = useState(DEFAULT_NEGATIVE_PROMPT);
+ const [negativePrompt, setNegativePrompt] = useState('');
const [showNegative, setShowNegative] = useState(false);
const [width, setWidth] = useState(1024);
const [height, setHeight] = useState(1024);
diff --git a/client/src/components/imageGen/ImageGenSettingsForm.jsx b/client/src/components/imageGen/ImageGenSettingsForm.jsx
index 8d8e2a831f..46db87a19f 100644
--- a/client/src/components/imageGen/ImageGenSettingsForm.jsx
+++ b/client/src/components/imageGen/ImageGenSettingsForm.jsx
@@ -171,7 +171,7 @@ export default function ImageGenSettingsForm({
rows={2}
value={cfg.negativePrompt || ''}
onChange={(e) => merge({ negativePrompt: e.target.value })}
- placeholder="blurry, low quality, watermark…"
+ placeholder="things to avoid, comma separated…"
className={textareaCls}
disabled={disabled}
/>
diff --git a/client/src/components/music/AlbumsManager.jsx b/client/src/components/music/AlbumsManager.jsx
index a0fcd30ec2..195d1ef33a 100644
--- a/client/src/components/music/AlbumsManager.jsx
+++ b/client/src/components/music/AlbumsManager.jsx
@@ -19,7 +19,6 @@ import ConfirmButtonPair from '../ui/ConfirmButtonPair';
import Field from '../ui/FormField';
import useMediaJobProgress from '../../hooks/useMediaJobProgress';
import { useConfirmDelete } from '../../hooks/useConfirmDelete';
-import { DEFAULT_NEGATIVE_PROMPT } from '../../lib/imageGenDefaults';
import { formatTimecode } from '../../utils/formatters';
import ArtistPicker from './ArtistPicker';
import AlbumTrackPicker from './AlbumTrackPicker';
@@ -144,7 +143,6 @@ export default function AlbumsManager() {
setStartingGen(true);
const queued = await generateImage({
prompt: buildCoverPrompt(form),
- negativePrompt: DEFAULT_NEGATIVE_PROMPT,
width: 1024,
height: 1024,
}, { silent: true }).catch((err) => ({ error: err }));
diff --git a/client/src/components/persona/PersonaMasterDetail.jsx b/client/src/components/persona/PersonaMasterDetail.jsx
index 83863877ce..1e33e6924b 100644
--- a/client/src/components/persona/PersonaMasterDetail.jsx
+++ b/client/src/components/persona/PersonaMasterDetail.jsx
@@ -8,7 +8,6 @@ import Field from '../ui/FormField';
import toast from '../ui/Toast';
import { useConfirmDelete } from '../../hooks/useConfirmDelete';
import useMediaJobProgress from '../../hooks/useMediaJobProgress';
-import { DEFAULT_NEGATIVE_PROMPT } from '../../lib/imageGenDefaults';
const byName = (a, b) => (a.name || '').localeCompare(b.name || '');
@@ -97,7 +96,7 @@ export default function PersonaMasterDetail({
setStartingGeneration(true);
const queued = await generateImage({
prompt: portrait.buildPrompt(form),
- negativePrompt: `${DEFAULT_NEGATIVE_PROMPT}, extra limbs, nsfw, nude`,
+ negativePrompt: 'extra limbs, nsfw, nude',
width: 768,
height: 1024,
}, { silent: true }).catch((err) => ({ error: err }));
diff --git a/client/src/hooks/useImageGenForm.js b/client/src/hooks/useImageGenForm.js
index f2fc464c54..439f726b03 100644
--- a/client/src/hooks/useImageGenForm.js
+++ b/client/src/hooks/useImageGenForm.js
@@ -19,7 +19,6 @@ import {
import { clampImageDimensions } from '../lib/imageGenResolutions';
import { peerModelRequiresInput } from '../lib/federatedMediaReadiness.js';
import { isHardwareCompatible } from '../utils/systemCapabilities';
-import { DEFAULT_NEGATIVE_PROMPT } from '../lib/imageGenDefaults';
import { resolveCleanersFromConfig } from '../lib/imageCleaners';
import useMounted from './useMounted';
import toast from '../components/ui/Toast';
@@ -69,7 +68,7 @@ export function useImageGenForm({ searchParams, setSearchParams, backend }) {
const remixLookupSequenceRef = useRef(0);
const remixHandoffPending = remixHandoff?.status === 'loading' || remixHandoff?.status === 'restoring';
const [prompt, setPrompt] = useState('');
- const [negativePrompt, setNegativePrompt] = useState(DEFAULT_NEGATIVE_PROMPT);
+ const [negativePrompt, setNegativePrompt] = useState('');
const [optionsOpen, setOptionsOpen] = useState(() => (
window.matchMedia?.('(min-width: 1024px)').matches ?? false
));
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index 9b689f9b4e..a6932bc388 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -113,7 +113,6 @@ grep -i "what you want to do" client/src/lib/README.md
| `imageGenBackends.js` | Icon metadata, `deriveAvailableBackends`, and `imageGenReadiness(status)` — a compatibility-safe `ready` / `unavailable` / `unknown` read of image-gen status responses; re-exports everything from `imageGenModes.js` so consumers keep one import site. |
| `imageGenModes.js` | Node-safe image/video backend constants + pure helpers. Re-exports the backend / render-target / lane alphabets from the server leaves `server/lib/generationModes.js` + `server/lib/renderTargets.js` (see its header for why nothing is copied); adds the Settings rows (`RENDER_TARGET_OPTIONS`), `applyRecordRenderPin` (fold a record's `imageMode`/`imageModelId` pin over a settings-derived cfg), `isCloudCliMode`/`isCloudVideoMode`, `modeLabel`, `mediaJobLane` (a projected media job's scheduler lane, re-derived for responses predating the server's `executionLane` field), and the cloud/model-override/i2i capability mirrors of the server service specs. Imported by the server-side parity suite — must stay importable without client packages. |
| `decks.js` | Deck alphabet, card roster/status/completion rules, face-orientation defaults/prompts, render-prompt composition, and `deckCardSize` / `deckCardAspectStyle` (thumbnail box from the deck's trim) — re-exported from `server/lib/deckTemplates.js` (one definition, no client copy). |
-| `imageGenDefaults.js` | Shared `DEFAULT_NEGATIVE_PROMPT` used by the Image Gen form and quick-submit entry points. Mirrors server-side default. |
| `imageGenResolutions.js` | Shared resolution presets for image generation. |
| `imageTo3dReasons.js` | Client mirror of the image-to-3D unavailable-reason labels in `server/services/imageTo3d/targets.js`: `UNAVAILABLE_REASONS` (reason code → user-facing label), `UNAVAILABLE_REASON_FALLBACK`, and `unavailableReasonLabel(code, fallback?)`, plus `isTargetReady(target)` — the shared readiness predicate (`installed` is tri-state: `null` = a hosted lane with no install concept, ready as soon as it is available). Use these anywhere a target's `unavailableReason` or readiness is rendered — never re-declare the codes or re-derive readiness from `target.installed` truthiness. Parity + code coverage enforced by `server/services/imageTo3d/unavailableReasons.parity.test.js`. |
| `imageTo3dTargetFixture.js` | `imageTo3dTarget(overrides)` — one representative image-to-3D target descriptor for tests. Shared by the `/3d` and Models → 3D suites so a server-side descriptor change is one edit, not two fixtures that can half-update. |
diff --git a/client/src/lib/imageGenDefaults.js b/client/src/lib/imageGenDefaults.js
deleted file mode 100644
index 430c4b7d91..0000000000
--- a/client/src/lib/imageGenDefaults.js
+++ /dev/null
@@ -1,9 +0,0 @@
-// Image-gen defaults shared between the full Image Gen form and quick-submit
-// entry points (e.g. the Dashboard Quick Image widget).
-//
-// The server keeps its own copy in `server/services/imageGen/defaults.js`
-// (the client cannot import server modules). The two are pinned together by
-// `server/services/imageGen/defaults.parity.test.js` — change one, and the
-// test names the other until they match again.
-
-export const DEFAULT_NEGATIVE_PROMPT = 'blurry, low quality, distorted, deformed, ugly, watermark, text, signature';
diff --git a/client/src/lib/index.js b/client/src/lib/index.js
index 6e0352a306..e08d7679d3 100644
--- a/client/src/lib/index.js
+++ b/client/src/lib/index.js
@@ -56,7 +56,6 @@ export * from './imageGenBackends.js';
// Namespace export: imageGenBackends re-exports every imageGenModes symbol
// flat (one import site for consumers), so a flat export here would collide.
export * as imageGenModes from './imageGenModes.js';
-export * from './imageGenDefaults.js';
export * from './imageGenResolutions.js';
export * from './imageTo3dReasons.js';
export * from './imageTo3dTargetFixture.js';
diff --git a/server/services/imageGen/defaults.js b/server/services/imageGen/defaults.js
deleted file mode 100644
index 07e2a89b70..0000000000
--- a/server/services/imageGen/defaults.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Image Gen — shared default constants.
- *
- * Standalone for the same reason as modes.js: the dispatcher (`index.js`)
- * and the provider modules (`external.js`, …) both import, so the base
- * negative prompt is defined exactly once on the server. The client keeps
- * its own mirror in `client/src/lib/imageGenDefaults.js` because it cannot
- * import server modules; `defaults.parity.test.js` fails when the two
- * drift apart.
- */
-
-export const DEFAULT_NEGATIVE_PROMPT = 'blurry, low quality, distorted, deformed, ugly, watermark, text, signature';
diff --git a/server/services/imageGen/defaults.parity.test.js b/server/services/imageGen/defaults.parity.test.js
deleted file mode 100644
index 22c7655866..0000000000
--- a/server/services/imageGen/defaults.parity.test.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import { describe, it, expect } from 'vitest';
-import { readFileSync, readdirSync } from 'node:fs';
-import { fileURLToPath } from 'node:url';
-import { dirname, join } from 'node:path';
-import { DEFAULT_NEGATIVE_PROMPT } from './defaults.js';
-
-const HERE = dirname(fileURLToPath(import.meta.url));
-const read = (p) => readFileSync(join(HERE, p), 'utf8');
-
-describe('imageGen defaults', () => {
- it('matches the client mirror, which cannot import this module', () => {
- // client/src/lib/imageGenDefaults.js hardcodes the same string for the
- // Image Gen form and the Dashboard Quick Image widget. If it drifts,
- // the user edits against one default while the server applies another —
- // silently, which is why this is a test and not a comment.
- const clientSrc = read('../../../client/src/lib/imageGenDefaults.js');
- const match = clientSrc.match(/DEFAULT_NEGATIVE_PROMPT = '([^']+)'/);
- expect(match, 'client mirror not found — did DEFAULT_NEGATIVE_PROMPT move?').toBeTruthy();
- expect(match[1]).toBe(DEFAULT_NEGATIVE_PROMPT);
- });
-
- it('is the only server-side definition of the base negative prompt', () => {
- // The dedupe this module exists for: discover the service's modules
- // rather than listing them, so a fresh pasted-in copy cannot sneak back
- // in next to a new provider.
- const offenders = readdirSync(HERE)
- .filter((f) => f.endsWith('.js') && !f.endsWith('.test.js') && f !== 'defaults.js')
- .map((f) => [f, read(f)])
- .filter(([, src]) => src.includes("'blurry, low quality"))
- .map(([f]) => f);
- expect(offenders, 'literal copies found outside defaults.js').toEqual([]);
- });
-});
diff --git a/server/services/imageGen/external.js b/server/services/imageGen/external.js
index 7390b13258..3988ae6111 100644
--- a/server/services/imageGen/external.js
+++ b/server/services/imageGen/external.js
@@ -17,7 +17,6 @@ import { fetchWithTimeout } from '../../lib/fetchWithTimeout.js';
import { autoCleanGeneratedImage } from '../../lib/imageClean.js';
import { imageGenEvents } from '../imageGenEvents.js';
import { IMAGE_GEN_MODE } from './modes.js';
-import { DEFAULT_NEGATIVE_PROMPT } from './defaults.js';
const PROGRESS_POLL_INTERVAL = 500;
const IMAGE_PREVIEW_THROTTLE = 2000;
@@ -118,7 +117,7 @@ export async function generateImage({ sdapiUrl, prompt, negativePrompt, width, h
const payload = {
prompt,
- negative_prompt: negativePrompt || DEFAULT_NEGATIVE_PROMPT,
+ negative_prompt: negativePrompt || '',
steps: steps || (isFlux ? 15 : 25),
width: width || (isFlux ? 832 : 512),
height: height || (isFlux ? 1216 : 768),
diff --git a/server/services/imageGen/external.test.js b/server/services/imageGen/external.test.js
index 2086d2f62e..8916a01144 100644
--- a/server/services/imageGen/external.test.js
+++ b/server/services/imageGen/external.test.js
@@ -38,6 +38,21 @@ describe('external image generation lifecycle', () => {
expect(imageGenEvents.emit).toHaveBeenCalledWith('failed', expect.objectContaining({ error: 'malformed response' }));
});
+ it('sends no negative prompt unless the caller supplies one', async () => {
+ // A built-in default ("blurry, low quality, …") used to be injected here and
+ // fought deliberately soft, grainy looks; empty means the model gets none.
+ fetchWithTimeout.mockImplementation(async (url) => {
+ if (url.endsWith('/txt2img')) throw new Error('stop after payload');
+ return response({ sd_model_checkpoint: 'example-model', progress: 0, state: {} });
+ });
+
+ await expect(generateImage({ sdapiUrl: 'http://example.com', prompt: 'a test image' }))
+ .rejects.toThrow('stop after payload');
+
+ const [, init] = fetchWithTimeout.mock.calls.find(([url]) => url.endsWith('/txt2img'));
+ expect(JSON.parse(init.body).negative_prompt).toBe('');
+ });
+
it('clears the polling interval when an unexpected progress handler error occurs', async () => {
vi.useFakeTimers();
const progressError = new Error('progress handler failed');
diff --git a/server/services/imageGen/index.js b/server/services/imageGen/index.js
index 35ab4a78b8..bb7aaa451a 100644
--- a/server/services/imageGen/index.js
+++ b/server/services/imageGen/index.js
@@ -29,7 +29,6 @@ import * as fal from './fal.js';
import {
IMAGE_GEN_MODE, IMAGE_GEN_MODES, CLOUD_IMAGE_GEN_MODES, isEditCapableMode,
} from './modes.js';
-import { DEFAULT_NEGATIVE_PROMPT } from './defaults.js';
import { resolveCloudProviderConfig } from './cloudProviderConfig.js';
import { rejectDegenerateFrame } from './frameGuard.js';
import { PATHS } from '../../lib/fileUtils.js';
@@ -237,7 +236,7 @@ export async function generateAvatar({ name, characterClass, prompt }) {
prompt: prompt || buildAvatarPrompt({ name, characterClass }),
width: 512,
height: 512,
- negativePrompt: `${DEFAULT_NEGATIVE_PROMPT}, nude, nsfw`,
+ negativePrompt: 'nude, nsfw',
});
}