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-3d): the setup card follows the picked Mac model, and real type classes

purple8343c755438e
diff --git a/src/components/create/experimental/ThreeDControls.tsx b/src/components/create/experimental/ThreeDControls.tsx
index aa5cbebc..9e830c5b 100644
--- a/src/components/create/experimental/ThreeDControls.tsx
+++ b/src/components/create/experimental/ThreeDControls.tsx
@@ -61,7 +61,7 @@ export function ThreeDControls({ maxViews, hasDetail, hasCutout, studioId, pictu
onChange={setWay}
options={WAYS.map((w) => ({ value: w, label: T.ways[w] }))}
/>
- {way === 'text' && pictureFirst && <p className="t-meta text-gray-400" data-testid="three-d-picture-first">{T.pictureFirst}</p>}
+ {way === 'text' && pictureFirst && <p className="t-micro text-gray-400" data-testid="three-d-picture-first">{T.pictureFirst}</p>}
{way === 'image' && maxViews > 1 && <SideStrip maxViews={maxViews} />}
{way === 'video' && <VideoFrames maxViews={maxViews} />}
<div className="flex flex-wrap items-center gap-4">
@@ -121,7 +121,7 @@ function SideStrip({ maxViews }: { maxViews: number }) {
<Slot key={name} name={name} image={views[i]} onPick={() => pick(i)} onClear={() => setViews(views.filter((_, k) => k !== i))} />
))}
</div>
- <span className="t-meta text-gray-500">{T.moreSidesSub}</span>
+ <span className="t-micro text-gray-500">{T.moreSidesSub}</span>
<input ref={inputRef} type="file" accept="image/*" className="hidden" onChange={(e) => { void onFile(e.target.files?.[0]); e.target.value = '' }} />
</div>
)
@@ -211,16 +211,16 @@ function VideoFrames({ maxViews }: { maxViews: number }) {
<Film size={14} />
{name ?? T.dropVideo}
</button>
- {reading && <span className="t-meta text-gray-400">{T.framesReading}</span>}
+ {reading && <span className="t-micro text-gray-400">{T.framesReading}</span>}
{frames.length > 0 && (
<>
- <span className="t-meta text-gray-400">{want > 1 ? T.framesMany : T.framesOne}</span>
+ <span className="t-micro text-gray-400">{want > 1 ? T.framesMany : T.framesOne}</span>
<div className="flex flex-wrap gap-2" data-testid="three-d-frames">
{frames.map((fr, i) => (
<Slot key={fr.url} name={`${i + 1}`} image={fr} active={picked.includes(i)} onPick={() => toggle(i)} />
))}
</div>
- <span className="t-meta text-gray-500">{T.videoHonest}</span>
+ <span className="t-micro text-gray-500">{T.videoHonest}</span>
</>
)}
<input ref={inputRef} type="file" accept="video/mp4,video/webm,video/quicktime" className="hidden" onChange={(e) => { void onFile(e.target.files?.[0]); e.target.value = '' }} />
diff --git a/src/components/create/experimental/ThreeDStage.tsx b/src/components/create/experimental/ThreeDStage.tsx
index 60e6167d..1f879cc6 100644
--- a/src/components/create/experimental/ThreeDStage.tsx
+++ b/src/components/create/experimental/ThreeDStage.tsx
@@ -136,21 +136,24 @@ function installLine(st: { status: string; download_progress?: number; download_
export function ThreeDSetupCard({ setup }: { setup: ThreeDSetup }) {
const mac = isMlxImageHost()
const openSettingsAt = useUIStore((s) => s.openSettingsAt)
- const gated = mac && !!setup.card?.gated
+ // The picked model decides the card, also before (or without) an answer
+ // from the engine: with Stable Fast 3D picked the card never offers TripoSR.
+ const picked = mac3dModel(useCreateStore((s) => s.threeDMacModel))
+ const gated = mac && (setup.card?.gated ?? picked.gated)
const title = !mac ? SETUP_TEXT.pcTitle : gated ? SETUP_TEXT.sf3dTitle : SETUP_TEXT.macTitle
const body = !mac ? SETUP_TEXT.pcBody : gated ? SETUP_TEXT.sf3dBody : SETUP_TEXT.macBody
const tokenMissing = gated && !setup.card?.hasToken
const licenseUrl = setup.card?.licenseUrl
return (
- <div className="m-auto flex flex-col items-center gap-3 max-w-[440px] text-center p-6" data-testid="three-d-setup">
+ <div className="m-auto flex flex-col items-center gap-3 max-w-[440px] max-h-full overflow-y-auto text-center p-6" data-testid="three-d-setup">
<Box size={30} className="text-gray-400" />
<h3 className="t-title text-gray-100">{title}</h3>
<p className="t-body text-gray-400">{body}</p>
{gated && setup.card?.licenseText && (
<div className="flex flex-col items-center gap-1.5 rounded-lg border border-white/[0.08] px-3 py-2" data-testid="three-d-license">
- <p className="t-meta text-gray-400 text-left">{setup.card.licenseText}</p>
+ <p className="t-micro leading-snug text-gray-400 text-left">{setup.card.licenseText}</p>
{licenseUrl && (
- <button type="button" className="t-meta text-gray-300 underline" onClick={() => void openExternal(licenseUrl)}>
+ <button type="button" className="t-body text-gray-300 underline" onClick={() => void openExternal(licenseUrl)}>
{SETUP_TEXT.licenseLink}
</button>
)}
@@ -158,19 +161,19 @@ export function ThreeDSetupCard({ setup }: { setup: ThreeDSetup }) {
)}
{tokenMissing && !setup.installing && (
<>
- <p className="t-meta text-gray-300" data-testid="three-d-token-needed">{SETUP_TEXT.tokenNeeded}</p>
+ <p className="t-body text-gray-300" data-testid="three-d-token-needed">{SETUP_TEXT.tokenNeeded}</p>
<Button variant="secondary" onClick={() => openSettingsAt({ tab: 'backends' })}>{SETUP_TEXT.tokenButton}</Button>
</>
)}
{setup.installing ? (
<>
- <p className="t-meta text-gray-300" data-testid="three-d-setup-line">{setup.line ?? T.phases.ready}</p>
+ <p className="t-body text-gray-300" data-testid="three-d-setup-line">{setup.line ?? T.phases.ready}</p>
<Button variant="secondary" onClick={setup.cancel}>{SETUP_TEXT.cancel}</Button>
</>
) : (
<Button variant="primary" onClick={setup.install} disabled={tokenMissing} data-testid="three-d-setup-install">{SETUP_TEXT.install}</Button>
)}
- {setup.error && <p className="t-meta text-red-300" role="alert">{setup.error}</p>}
+ {setup.error && <p className="t-body text-red-300" role="alert">{setup.error}</p>}
</div>
)
}
@@ -182,7 +185,7 @@ export function ThreeDVideoHint() {
<div className="m-auto flex flex-col items-center gap-2 max-w-[420px] text-center p-6" data-testid="three-d-video-hint">
<Film size={28} className="text-gray-400" />
<p className="t-body text-gray-300">{T.dropVideo}</p>
- <p className="t-meta text-gray-500">{T.dropVideoSub}</p>
+ <p className="t-body text-gray-500">{T.dropVideoSub}</p>
</div>
)
}
diff --git a/src/components/create/experimental/__tests__/three-d-type-classes.test.ts b/src/components/create/experimental/__tests__/three-d-type-classes.test.ts
new file mode 100644
index 00000000..1f22d96b
--- /dev/null
+++ b/src/components/create/experimental/__tests__/three-d-type-classes.test.ts
@@ -0,0 +1,24 @@
+/**
+ * The 3D files used a type class `t-meta` that does not exist (the text fell
+ * back to the browser's 16 px, larger than the body text). Every `t-…` class
+ * in them must be one index.css defines.
+ */
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+
+const css = readFileSync(resolve('src/index.css'), 'utf8')
+const defined = new Set([...css.matchAll(/^\.(t-[a-z]+)\s*\{/gm)].map((m) => m[1]))
+const FILES = [
+ 'src/components/create/experimental/ThreeDStage.tsx',
+ 'src/components/create/experimental/ThreeDControls.tsx',
+ 'src/components/three/ModelViewer.tsx',
+]
+
+describe('the 3D files use only type classes that exist', () => {
+ it.each(FILES)('%s', (file) => {
+ const used = new Set([...readFileSync(resolve(file), 'utf8').matchAll(/["'\s`](t-(?:display|title|body|control|label|mono|micro|meta|small|caption|[a-z]+))(?=[\s"'`])/g)].map((m) => m[1]))
+ const unknown = [...used].filter((c) => !defined.has(c) && /^t-[a-z]+$/.test(c))
+ expect(unknown).toEqual([])
+ })
+})