Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(create): C2 - add adult field to CloudModel and the No refusals mark to ModelChip (web parity)

purple7169064bbb6c
diff --git a/src/components/create/experimental/ModelChip.tsx b/src/components/create/experimental/ModelChip.tsx
index b31a558e..753d4e68 100644
--- a/src/components/create/experimental/ModelChip.tsx
+++ b/src/components/create/experimental/ModelChip.tsx
@@ -2,11 +2,23 @@ import { useCreateStore } from '../../../stores/createStore'
import { useCloudCatalogStore, defaultCloudModel, opPickerModels, modelCostHint } from '../../../stores/cloudCatalogStore'
import { useSettingsStore } from '../../../stores/settingsStore'
import { useUIStore } from '../../../stores/uiStore'
+import { useContentPolicy } from '../../../hooks/useContentPolicy'
import { Select, type SelectOption } from '../ui/Select'
import { TYPE_BADGE } from './badges'
import { resolveLocalOpPick, videoLaneModels } from '../../../api/comfyui'
const CLOUD_BADGE = { label: 'Cloud', color: 'bg-violet-500/15 text-violet-500 dark:text-violet-200' }
+// C2: the "No refusals" mark on models the provider ships with its own
+// filter off (CloudModel.adult, web parity: apps/web/components/create/
+// experimental/ModelChip.tsx). The mark says what the MODEL can do and
+// decides nothing itself — while the account's content policy still filters
+// (anything but 'off'), it stays pale: the account setting is the boundary,
+// not the model. No adult vocabulary here, this surface sits on the payment
+// domain.
+const NO_REFUSALS_COLOR = {
+ filtering: 'text-gray-500 dark:text-gray-600',
+ open: 'text-purple-600 dark:text-purple-300',
+}
// Local-mode discovery (2.5.8): hosted models ride at the bottom of the local
// picker as teaser rows — picking one opens the Cloud sheet instead of
@@ -35,6 +47,7 @@ function CloudModelChip() {
// slider live so the shown price is the billed price (A3, sockenmonster).
const musicDuration = useCreateStore((s) => s.musicDuration)
const models = useCloudCatalogStore((s) => s.models)
+ const contentPolicy = useContentPolicy()
const isVideo = mode === 'video'
const kind = isVideo ? 'video' : 'image'
@@ -80,7 +93,11 @@ function CloudModelChip() {
value: m.id,
label: m.label,
sublabel: modelCostHint(m, op, op === 'music' ? musicDuration : undefined),
- badge: CLOUD_BADGE,
+ // adult models keep the standard Cloud badge everywhere EXCEPT the row
+ // itself, where "No refusals" is strictly more informative — matches web.
+ badge: m.adult
+ ? { label: 'No refusals', color: contentPolicy === 'off' ? NO_REFUSALS_COLOR.open : NO_REFUSALS_COLOR.filtering }
+ : CLOUD_BADGE,
}))
return (
diff --git a/src/components/create/experimental/__tests__/no-refusals-badge.test.tsx b/src/components/create/experimental/__tests__/no-refusals-badge.test.tsx
new file mode 100644
index 00000000..957341b2
--- /dev/null
+++ b/src/components/create/experimental/__tests__/no-refusals-badge.test.tsx
@@ -0,0 +1,84 @@
+// @vitest-environment jsdom
+/**
+ * C2 (Desktop Create parity, web reference: apps/web/components/create/
+ * experimental/ModelChip.tsx). Two pieces:
+ *
+ * 1. `adult` on the Desktop CloudModel type (src/lib/render/cloud-models.ts)
+ * — previously absent entirely, so every "Spicy" seed model looked
+ * identical to a filtered one. A live /api/jobs/catalog payload without
+ * the field (older server, pre web-fix) must read as "not adult", never
+ * throw or crash the picker — it's a plain optional boolean.
+ * 2. The "No refusals" badge in ModelChip's CloudModelChip, pale while the
+ * account's content policy still filters and vivid when it's 'off' —
+ * same rule as web, adapted to Desktop's own useContentPolicy hook
+ * (src/hooks/useContentPolicy.ts) instead of web's use-content-policy.
+ *
+ * Run: npx vitest run src/components/create/experimental/__tests__/no-refusals-badge.test.tsx
+ */
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { cleanup, render, screen } from '@testing-library/react'
+import { CLOUD_MODEL_SEED } from '../../../../lib/render/cloud-models'
+
+const policyState = vi.hoisted(() => ({ value: 'soft' as 'strict' | 'soft' | 'off' }))
+vi.mock('../../../../hooks/useContentPolicy', () => ({
+ useContentPolicy: () => policyState.value,
+ primeContentPolicyCache: vi.fn(),
+}))
+
+import { ModelChip } from '../ModelChip'
+import { useCreateStore } from '../../../../stores/createStore'
+import { useCloudCatalogStore } from '../../../../stores/cloudCatalogStore'
+
+afterEach(() => {
+ cleanup()
+ policyState.value = 'soft'
+})
+
+describe('CloudModel.adult (seed data)', () => {
+ it('marks every hosted "Spicy" endpoint adult, and nothing else', () => {
+ const adultIds = CLOUD_MODEL_SEED.filter((m) => m.adult).map((m) => m.id).sort()
+ const spicyIds = CLOUD_MODEL_SEED.filter((m) => m.label.includes('Spicy')).map((m) => m.id).sort()
+ expect(adultIds).toEqual(spicyIds)
+ expect(adultIds.length).toBeGreaterThan(0)
+ })
+})
+
+describe('ModelChip "No refusals" badge', () => {
+ const setup = (modelId: string) => {
+ // videoSubMode 'i2v' derives the 'animate' intent (deriveIntent in
+ // createStore.ts) — the picker whose model filter (i2v !== false) actually
+ // keeps the i2v-only "Spicy" seed models in list, unlike the plain 'video'
+ // (t2v) intent which filters them straight back out.
+ useCreateStore.setState({
+ backend: 'cloud', mode: 'video', videoSubMode: 'i2v', removebg: false, utilityOp: null, cloudOp: null,
+ cloudVideoModel: modelId, cloudImageModel: '', cloudOpModel: '',
+ })
+ useCloudCatalogStore.setState({ models: CLOUD_MODEL_SEED })
+ }
+
+ it('shows "No refusals" pale while the account content policy still filters', () => {
+ policyState.value = 'soft'
+ setup('wan-2.2-spicy')
+ render(<ModelChip />)
+ const label = screen.getByText('No refusals')
+ // The Select renders the current value's badge next to the trigger.
+ expect(label.className).toContain('text-gray-500')
+ expect(label.className).not.toContain('text-purple-600')
+ })
+
+ it('shows "No refusals" vivid once the account policy is off', () => {
+ policyState.value = 'off'
+ setup('wan-2.2-spicy')
+ render(<ModelChip />)
+ const label = screen.getByText('No refusals')
+ expect(label.className).toContain('text-purple-600')
+ })
+
+ it('a non-adult cloud model keeps the plain Cloud badge, never "No refusals"', () => {
+ policyState.value = 'off'
+ setup('wan-2.2-720p')
+ render(<ModelChip />)
+ expect(screen.queryByText('No refusals')).toBeNull()
+ expect(screen.getByText('Cloud')).toBeTruthy()
+ })
+})
diff --git a/src/components/settings/ContentPolicySettings.tsx b/src/components/settings/ContentPolicySettings.tsx
index bffe8c72..14a436a5 100644
--- a/src/components/settings/ContentPolicySettings.tsx
+++ b/src/components/settings/ContentPolicySettings.tsx
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useState } from 'react'
import { HINWEIS_TEXT } from '../../lib/hinweis'
import { getContentPolicy, setContentPolicy, type ContentPolicy } from '../../api/cloud/jobs'
import { useCloudAuthStore } from '../../stores/cloudAuthStore'
+import { primeContentPolicyCache } from '../../hooks/useContentPolicy'
/*
* Der Zusatz am Off-Hinweis haengt am Schalter des Servers. Ein Satz, der eine
@@ -66,6 +67,10 @@ export function ContentPolicySettings() {
try {
const saved = await setContentPolicy(next, ageConfirmed)
setPolicy(saved)
+ // C2: the ModelChip badge reads a separate shared cache (useContentPolicy)
+ // so it does not fire its own GET per mount — push the fresh value in
+ // immediately instead of leaving it to catch up on the next reload.
+ primeContentPolicyCache(saved)
/*
* Das Bestaetigungsdatum kommt vom Server, nicht von der Uhr dieses
* Rechners (R2-30). `setContentPolicy` gibt nur die Richtlinie zurueck,
diff --git a/src/hooks/useContentPolicy.ts b/src/hooks/useContentPolicy.ts
new file mode 100644
index 00000000..12545721
--- /dev/null
+++ b/src/hooks/useContentPolicy.ts
@@ -0,0 +1,60 @@
+import { useEffect, useState } from 'react'
+import { getContentPolicy, type ContentPolicy } from '../api/cloud/jobs'
+
+/**
+ * C2: the account's content policy, fetched once and shared across every
+ * surface that only needs it for DISPLAY (today: ModelChip's "No refusals"
+ * mark). Mirrors uselu apps/web/lib/render/use-content-policy.ts so the same
+ * rule reads the same way on both sides — a small module-level cache plus a
+ * listener set, instead of every mounted ModelChip firing its own GET.
+ *
+ * Read-only. The server re-checks the real policy on every render job
+ * (ContentPolicySettings.tsx already owns the write path); a stale or wrong
+ * value here mislabels a badge, it grants nothing.
+ */
+let cached: ContentPolicy | null = null
+let inflight: Promise<ContentPolicy> | null = null
+const listeners = new Set<(p: ContentPolicy) => void>()
+
+async function loadContentPolicy(): Promise<ContentPolicy> {
+ if (cached) return cached
+ if (!inflight) {
+ inflight = getContentPolicy()
+ .then((s) => {
+ // A concurrent write (ContentPolicySettings' save()) may already have
+ // primed the cache while this GET was in flight — that newer value
+ // wins, this response must not overwrite it.
+ if (cached) return cached
+ cached = s.policy
+ listeners.forEach((l) => l(s.policy))
+ return s.policy
+ })
+ .catch(() => 'soft' as ContentPolicy)
+ .finally(() => { inflight = null })
+ }
+ return inflight
+}
+
+/** Push a freshly saved policy into the shared cache (call after a
+ * successful PUT), so every mounted ModelChip picks it up immediately
+ * instead of waiting for a reload. */
+export function primeContentPolicyCache(policy: ContentPolicy): void {
+ cached = policy
+ listeners.forEach((l) => l(policy))
+}
+
+/** Test-only: drop the cache between cases. */
+export function _resetContentPolicyCache(): void {
+ cached = null
+ inflight = null
+}
+
+export function useContentPolicy(): ContentPolicy {
+ const [policy, setPolicy] = useState<ContentPolicy>(cached ?? 'soft')
+ useEffect(() => {
+ listeners.add(setPolicy)
+ void loadContentPolicy().then(setPolicy)
+ return () => { listeners.delete(setPolicy) }
+ }, [])
+ return policy
+}
diff --git a/src/lib/render/cloud-models.ts b/src/lib/render/cloud-models.ts
index 46d7f746..a0dd5624 100644
--- a/src/lib/render/cloud-models.ts
+++ b/src/lib/render/cloud-models.ts
@@ -18,6 +18,16 @@ export interface CloudModel {
/** Video: renders image-to-video (the "Animate Image" intent). Absent = yes;
* set false on a t2v-only model to keep it out of the Animate picker. */
i2v?: boolean
+ /** C2: the provider ships this endpoint with its own filter off, so it
+ * produces adult output when the account's content policy allows it (server
+ * migration 0042, uselu apps/web/lib/render/cloud-models.ts). Drives the
+ * "No refusals" picker mark (ModelChip.tsx) and grants nothing on its own —
+ * the server re-checks the account's policy on every job, this field is
+ * display only. Optional and defaults to falsy: the live catalog
+ * (GET /api/jobs/catalog) only started emitting it once the web-side fix
+ * landed, and an older/offline payload without the field must read as "not
+ * adult", never crash or silently mismark a model. */
+ adult?: boolean
/** 2.5.8 op-specialized models (trainers, lipsync, voice, music, extend,
* motion, LoRA-gen): exactly the ops this model serves. Absent on classic
* models — every classic picker filters on `!m.ops`. */
@@ -58,9 +68,9 @@ export const CLOUD_MODEL_SEED: CloudModel[] = [
{ id: 'hidream', label: 'HiDream', kind: 'image' },
{ id: 'hunyuan-image', label: 'HunyuanImage 2.1', kind: 'image' },
{ id: 'z-image-turbo', label: 'Z-Image Turbo (fast)', kind: 'image' },
- { id: 'chroma', label: 'Chroma Spicy', kind: 'image' },
- { id: 'prefect-pony', label: 'Prefect Pony XL Spicy', kind: 'image' },
- { id: 'neta-lumina', label: 'Neta Lumina (anime) Spicy', kind: 'image' },
+ { id: 'chroma', label: 'Chroma Spicy', kind: 'image', adult: true },
+ { id: 'prefect-pony', label: 'Prefect Pony XL Spicy', kind: 'image', adult: true },
+ { id: 'neta-lumina', label: 'Neta Lumina (anime) Spicy', kind: 'image', adult: true },
// Every hosted clip model does both t2v + i2v, so both flags are true. They're
// the enforced contract (Video/Animate pickers + submit filter on them), not a
// note — a future t2v-only or i2v-only model MUST set the flag it lacks to
@@ -77,17 +87,17 @@ export const CLOUD_MODEL_SEED: CloudModel[] = [
// first, then one of these. CLIP does not fit here, the provider quotes only
// a 5 s rate for them, so there is no 8s button to offer.
// 2026-09-10:
- { id: 'wan-2.2-spicy', label: 'Wan 2.2 Spicy', kind: 'video', t2v: false, i2v: true, clip: { short: 5 }, credits: { base: 15000, lora: 20000 } },
- { id: 'ltx-2.3-spicy', label: 'LTX 2.3 Spicy', kind: 'video', t2v: false, i2v: true, clip: { short: 5 }, credits: { base: 10000, lora: 15000 } },
- { id: 'wan-2.6-spicy', label: 'Wan 2.6 Spicy', kind: 'video', t2v: false, i2v: true, clip: { short: 5 }, credits: { base: 50000 } },
- { id: 'wan-2.7-spicy', label: 'Wan 2.7 Spicy', kind: 'video', t2v: false, i2v: true, clip: { short: 5 }, credits: { base: 50000 } },
- { id: 'minimax-h3-spicy', label: 'MiniMax H3 Spicy', kind: 'video', t2v: false, i2v: true, clip: { short: 5 }, credits: { base: 20000 } },
- { id: 'seedance-1.5-pro-spicy', label: 'Seedance 1.5 Pro Spicy', kind: 'video', t2v: false, i2v: true, clip: { short: 5 }, credits: { base: 26000 } },
+ { id: 'wan-2.2-spicy', label: 'Wan 2.2 Spicy', kind: 'video', t2v: false, i2v: true, adult: true, clip: { short: 5 }, credits: { base: 15000, lora: 20000 } },
+ { id: 'ltx-2.3-spicy', label: 'LTX 2.3 Spicy', kind: 'video', t2v: false, i2v: true, adult: true, clip: { short: 5 }, credits: { base: 10000, lora: 15000 } },
+ { id: 'wan-2.6-spicy', label: 'Wan 2.6 Spicy', kind: 'video', t2v: false, i2v: true, adult: true, clip: { short: 5 }, credits: { base: 50000 } },
+ { id: 'wan-2.7-spicy', label: 'Wan 2.7 Spicy', kind: 'video', t2v: false, i2v: true, adult: true, clip: { short: 5 }, credits: { base: 50000 } },
+ { id: 'minimax-h3-spicy', label: 'MiniMax H3 Spicy', kind: 'video', t2v: false, i2v: true, adult: true, clip: { short: 5 }, credits: { base: 20000 } },
+ { id: 'seedance-1.5-pro-spicy', label: 'Seedance 1.5 Pro Spicy', kind: 'video', t2v: false, i2v: true, adult: true, clip: { short: 5 }, credits: { base: 26000 } },
// 2026-09-13:
- { id: 'seedance-2.5-spicy', label: 'Seedance 2.5 Spicy', kind: 'video', t2v: false, i2v: true, clip: { short: 5 }, credits: { base: 90000 } },
- { id: 'seedance-2.0-spicy', label: 'Seedance 2.0 Spicy', kind: 'video', t2v: false, i2v: true, clip: { short: 5 }, credits: { base: 60000 } },
- { id: 'seedance-2.0-fast-spicy', label: 'Seedance 2.0 Fast Spicy', kind: 'video', t2v: false, i2v: true, clip: { short: 5 }, credits: { base: 50000 } },
- { id: 'vidu-q3-spicy', label: 'Vidu Q3 Spicy', kind: 'video', t2v: false, i2v: true, clip: { short: 5 }, credits: { base: 35000 } },
+ { id: 'seedance-2.5-spicy', label: 'Seedance 2.5 Spicy', kind: 'video', t2v: false, i2v: true, adult: true, clip: { short: 5 }, credits: { base: 90000 } },
+ { id: 'seedance-2.0-spicy', label: 'Seedance 2.0 Spicy', kind: 'video', t2v: false, i2v: true, adult: true, clip: { short: 5 }, credits: { base: 60000 } },
+ { id: 'seedance-2.0-fast-spicy', label: 'Seedance 2.0 Fast Spicy', kind: 'video', t2v: false, i2v: true, adult: true, clip: { short: 5 }, credits: { base: 50000 } },
+ { id: 'vidu-q3-spicy', label: 'Vidu Q3 Spicy', kind: 'video', t2v: false, i2v: true, adult: true, clip: { short: 5 }, credits: { base: 35000 } },
// ── 2.5.8 op-specialized fleet (Character-Studio / lipsync / voice / music /
// extend / motion). `ops` keeps them out of every classic picker; the live
@@ -110,7 +120,7 @@ export const CLOUD_MODEL_SEED: CloudModel[] = [
{ id: 'ace-step', label: 'ACE-Step (fast)', kind: 'audio', ops: ['music'], credits: { base: 1200, per_s: 20 } },
{ id: 'ace-step-1.5', label: 'ACE-Step 1.5', kind: 'audio', ops: ['music'], lyrics: true, credits: { base: 1800, per_s: 30 } },
{ id: 'sonilo-music', label: 'Sonilo Music', kind: 'audio', ops: ['music'], credits: { base: 15000, per_s: 250 } },
- { id: 'wan-2.2-spicy-extend', label: 'Wan 2.2 Spicy Extend', kind: 'video', ops: ['extend'], t2v: false, i2v: false, credits: { base: 15000, lora: 20000 } },
+ { id: 'wan-2.2-spicy-extend', label: 'Wan 2.2 Spicy Extend', kind: 'video', ops: ['extend'], t2v: false, i2v: false, adult: true, credits: { base: 15000, lora: 20000 } },
{ id: 'ltx-2-extend', label: 'LTX-2 Extend', kind: 'video', ops: ['extend'], t2v: false, i2v: false },
{ id: 'pixverse-extend', label: 'Pixverse Extend (fast)', kind: 'video', ops: ['extend'], t2v: false, i2v: false },
{ id: 'wan-2.2-animate', label: 'Wan 2.2 Animate', kind: 'video', ops: ['motion'], t2v: false, i2v: false },