Suno-style web UI for a self-hosted MiniMax-Music3 inference server
TypeScript ai-musicdiffusersdockerexpressminimaxminimax-musicmusic-generationreactself-hostedsgl-omnisunotailwindcsstext-to-musictypescriptvite
ui: track detail side panel opened by clicking a card
Adam Benhassendf3178e4f530
diff --git a/README.md b/README.mdindex b7931aa..5b3376e 100644--- a/README.md+++ b/README.md@@ -27,6 +27,7 @@- **Render queue** — the UI server renders one track at a time against the blocking `/v1/audio/speech` route and shows queued / rendering / done with elapsed time and an estimated bar (~3× realtime — the official API reports no progress). Cancel while queued or rendering, retry on error. Queued tracks survive a UI-server restart (they are re-queued in order); a render that was in flight is marked as interrupted.- **Live progress + play while rendering** — when the server is the bundled `inference/server.py` (it advertises `capabilities: ["stream"]` on `/health`), progress is real for every render (Generating → Rendering, ETA from the measured rate). Tick *Play while rendering* under Advanced and the audio is streamed as it's rendered too: press play on a track that is still rendering, the waveform grows as windows arrive, the player buffers when it catches up with the renderer and swaps to the final file seamlessly. Stock `sgl-omni` keeps the estimated bar.- **Library** — every finished render is saved into `data/tracks/` with its metadata (prompt, lyrics, seed, format). Cards show duration, seed and how long the render took. Search, download, delete, "reuse settings".+- **Track panel** — click a card to open a Suno-style side panel: big cover with play, status/progress, Download / Reuse / Retry / Delete, full style prompt and lyrics, and details (duration, seed, render time, created/finished). Esc closes it.- **Player** — sticky bottom bar with waveform (decoded client-side), seek, prev/next, keyboard space to play/pause.- **Health pill** — offline / loading model / idle (· live progress) / rendering · N queued (probes `GET /v1/models` and the optional `GET /health`).- **Settings page** — point the app at your inference server (URL + optional API key) from the UI, with a "Test connection" button. Environment variables, when set, take precedence and lock those fields. A *Compatibility mode* debug switch makes the UI treat any server as stock `sgl-omni` (no `/health`, no streaming) to check the plain contract still works.diff --git a/web/src/App.tsx b/web/src/App.tsxindex df2a727..a5e1e6d 100644--- a/web/src/App.tsx+++ b/web/src/App.tsx@@ -8,6 +8,7 @@ import { CreatePanel, DEFAULT_FORM, formFromTrack, type FormState } from './compimport { TrackFeed } from './components/TrackFeed';import { Player } from './components/Player';import { SettingsPanel } from './components/SettingsPanel';+import { TrackDetail } from './components/TrackDetail';const FORM_KEY = 'minimax-music-ui.form';@@ -25,6 +26,7 @@ export default function App() {const [form, setForm] = useState<FormState>(loadForm);const [query, setQuery] = useState('');const [activeId, setActiveId] = useState<string | null>(null);+ const [selectedId, setSelectedId] = useState<string | null>(null);const [playing, setPlaying] = useState(false);const health = useHealth();const { tracks, error: libError, refresh, setTracks } = useLibrary();@@ -33,6 +35,8 @@ export default function App() {const doneTracks = useMemo(() => tracks.filter((t) => t.status === 'done'), [tracks]);const active = useMemo(() => tracks.find((t) => t.id === activeId) ?? null, [tracks, activeId]);+ const selected = useMemo(() => tracks.find((t) => t.id === selectedId) ?? null, [tracks, selectedId]);+ const closeDetail = useCallback(() => setSelectedId(null), []);const inflight = tracks.filter(isInflight).length;const visible = useMemo(() => {@@ -65,6 +69,7 @@ export default function App() {if (!confirm(`${verb} “${t.title}”?`)) return;setTracks((prev) => prev.filter((x) => x.id !== t.id));if (t.id === activeId) { setActiveId(null); setPlaying(false); }+ if (t.id === selectedId) setSelectedId(null);try { await api.deleteTrack(t.id); } catch (err) { alert((err as Error).message); }void refresh();};@@ -78,7 +83,9 @@ export default function App() {<TrackFeedtracks={visible}activeId={activeId}+ selectedId={selectedId}playing={playing}+ onSelect={(t) => setSelectedId((cur) => (cur === t.id ? null : t.id))}onPlay={play}onDelete={remove}onReuse={reuse}@@ -120,6 +127,19 @@ export default function App() {</div>)}</main>+ {selected && view !== 'settings' && (+ <TrackDetail+ track={selected}+ groupSize={tracks.filter((t) => t.groupId === selected.groupId).length}+ active={selected.id === activeId}+ playing={playing && selected.id === activeId}+ onClose={closeDetail}+ onPlay={play}+ onDelete={remove}+ onReuse={reuse}+ onRetry={retry}+ />+ )}</div><Player track={active} playing={playing} onPlayingChange={setPlaying} onPrev={() => step(-1)} onNext={() => step(1)} onEnded={() => step(1)} /></div>diff --git a/web/src/components/TrackCard.tsx b/web/src/components/TrackCard.tsxindex 0f94530..fd4118c 100644--- a/web/src/components/TrackCard.tsx+++ b/web/src/components/TrackCard.tsx@@ -11,13 +11,15 @@ interface Props {groupSize: number;active: boolean;playing: boolean;+ selected: boolean;+ onSelect: (t: Track) => void;onPlay: (t: Track) => void;onDelete: (t: Track) => void;onReuse: (t: Track) => void;onRetry: (t: Track) => void;}-export function TrackCard({ track: t, groupSize, active, playing, onPlay, onDelete, onReuse, onRetry }: Props) {+export function TrackCard({ track: t, groupSize, active, playing, selected, onSelect, onPlay, onDelete, onReuse, onRetry }: Props) {const [open, setOpen] = useState(false);const inflight = isInflight(t);const done = t.status === 'done';@@ -26,7 +28,10 @@ export function TrackCard({ track: t, groupSize, active, playing, onPlay, onDeleconst err = t.status === 'error';return (- <div className={`group rounded-xl border transition ${active ? 'border-accent/60 bg-ink-800' : 'border-ink-700 bg-ink-900 hover:bg-ink-800'} `}>+ <div+ className={`group rounded-xl border transition cursor-pointer ${selected ? 'ring-1 ring-accent/60 ' : ''}${active ? 'border-accent/60 bg-ink-800' : 'border-ink-700 bg-ink-900 hover:bg-ink-800'} `}+ onClick={(e) => { if (!(e.target as HTMLElement).closest('button, a, pre')) onSelect(t); }}+ ><div className="flex gap-3 p-3"><buttononClick={() => playable && onPlay(t)}@@ -65,7 +70,7 @@ export function TrackCard({ track: t, groupSize, active, playing, onPlay, onDele</div></div>- <div className="mt-2 flex items-center gap-2 text-[11px] text-zinc-500 tabular-nums">+ <div className="mt-2 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-zinc-500 tabular-nums whitespace-nowrap"><span>{fmtTime(t.duration)}</span>{t.seed !== null && (<><span>·</span><span className="font-mono">seed {t.seed}</span></>)}{done && typeof t.elapsed === 'number' && t.elapsed > 0 && (<><span>·</span><span title="render time">took {fmtTook(t.elapsed)}</span></>)}diff --git a/web/src/components/TrackDetail.tsx b/web/src/components/TrackDetail.tsxnew file mode 100644index 0000000..7a95ad1--- /dev/null+++ b/web/src/components/TrackDetail.tsx@@ -0,0 +1,120 @@+import { useEffect } from 'react';+import { isInflight, isPlayable, type Track } from '../types';+import { coverStyle } from '../lib/cover';+import { fmtTime, fmtTook } from '../lib/format';+import { api } from '../api';+import { Download, Pause, Play, Refresh, Reuse, Spinner, Trash, X } from './Icons';+import { ProgressDetail } from './ProgressDetail';++interface Props {+ track: Track;+ groupSize: number;+ active: boolean;+ playing: boolean;+ onClose: () => void;+ onPlay: (t: Track) => void;+ onDelete: (t: Track) => void;+ onReuse: (t: Track) => void;+ onRetry: (t: Track) => void;+}++const fmtDate = (iso: string) => new Date(iso).toLocaleString([], { dateStyle: 'medium', timeStyle: 'short' });++/** Suno-style side panel with everything about one track. */+export function TrackDetail({ track: t, groupSize, active, playing, onClose, onPlay, onDelete, onReuse, onRetry }: Props) {+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); };+ window.addEventListener('keydown', onKey);+ return () => window.removeEventListener('keydown', onKey);+ }, [onClose]);++ const inflight = isInflight(t);+ const done = t.status === 'done';+ const err = t.status === 'error';+ const playable = isPlayable(t);+ const armed = active && playing && t.status === 'running' && (t.renderedSeconds ?? 0) === 0;+ const instrumental = t.lyrics === '[Instrumental]';++ const rows: [string, string][] = [+ ['Duration', fmtTime(t.duration)],+ ['Seed', t.seed === null ? 'random' : String(t.seed)],+ ['Format', t.format.toUpperCase()],+ ...(done && typeof t.elapsed === 'number' && t.elapsed > 0 ? [['Render time', fmtTook(t.elapsed)] as [string, string]] : []),+ ['Created', fmtDate(t.createdAt)],+ ...(t.finishedAt ? [[err ? 'Failed' : 'Finished', fmtDate(t.finishedAt)] as [string, string]] : []),+ ...(t.stream ? [['Play while rendering', 'on'] as [string, string]] : []),+ ];++ return (+ <aside className="fixed inset-y-0 right-0 z-30 w-full sm:w-[380px] lg:static lg:z-auto lg:w-[360px] xl:w-[400px] shrink-0 flex flex-col bg-ink-900 border-l border-ink-700 shadow-2xl lg:shadow-none">+ <div className="h-14 shrink-0 flex items-center justify-between px-4 border-b border-ink-700">+ <span className="text-xs uppercase tracking-wide text-zinc-500">Track</span>+ <button className="icon-btn" title="Close (Esc)" onClick={onClose}><X width={18} height={18} /></button>+ </div>++ <div className="flex-1 min-h-0 overflow-y-auto p-4 space-y-5">+ <div className="relative rounded-2xl overflow-hidden aspect-square max-w-[300px] mx-auto" style={coverStyle(t.id)}>+ {playable && (+ <button+ onClick={() => onPlay(t)}+ className="absolute inset-0 flex items-center justify-center bg-black/25 hover:bg-black/40 transition text-white"+ aria-label={active && playing ? 'Pause' : 'Play'}+ >+ <span className="w-16 h-16 rounded-full bg-white/15 backdrop-blur flex items-center justify-center">+ {armed ? <Spinner width={28} height={28} /> : active && playing ? <Pause width={28} height={28} /> : <Play width={28} height={28} />}+ </span>+ </button>+ )}+ {inflight && (+ <span className="absolute bottom-3 left-3 px-2 py-0.5 rounded-md bg-black/50 text-[11px] font-mono tabular-nums text-white">{Math.round(t.progress * 100)}%</span>+ )}+ </div>++ <div>+ <div className="text-lg font-semibold leading-tight break-words">{t.title}</div>+ <div className="text-xs text-zinc-500 mt-1">+ {groupSize > 1 && <>take {t.takeIndex + 1} of {groupSize} · </>}+ {inflight ? (t.status === 'queued' ? 'queued' : 'rendering') : err ? 'failed' : 'ready'}+ </div>+ </div>++ {inflight && <ProgressDetail track={t} />}+ {err && <div className="text-xs text-red-400 break-words rounded-lg bg-red-500/10 border border-red-500/30 px-3 py-2">{t.error}</div>}++ <div className="flex flex-wrap items-center gap-2">+ {done && <a className="btn-ghost border border-ink-600" href={api.downloadUrl(t.id)}><Download width={16} height={16} /> Download</a>}+ <button className="btn-ghost border border-ink-600" onClick={() => onReuse(t)}><Reuse width={16} height={16} /> Reuse settings</button>+ {err && <button className="btn-ghost border border-ink-600" onClick={() => onRetry(t)}><Refresh width={16} height={16} /> Retry</button>}+ <button className="btn-ghost border border-ink-600 hover:!text-red-400" onClick={() => onDelete(t)}>+ {inflight ? <><X width={16} height={16} /> Cancel</> : <><Trash width={16} height={16} /> Delete</>}+ </button>+ </div>++ <section>+ <h3 className="label mb-1">Style</h3>+ <p className="text-sm text-zinc-300 whitespace-pre-wrap break-words">{t.prompt}</p>+ </section>++ <section>+ <h3 className="label mb-1">Lyrics</h3>+ {instrumental+ ? <p className="text-sm text-zinc-500 italic">Instrumental</p>+ : <pre className="p-3 rounded-lg bg-ink-950 text-[12px] leading-relaxed text-zinc-300 whitespace-pre-wrap font-mono">{t.lyrics}</pre>}+ </section>++ <section>+ <h3 className="label mb-1">Details</h3>+ <dl className="grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-xs">+ {rows.map(([k, v]) => (+ <div key={k} className="contents">+ <dt className="text-zinc-500">{k}</dt>+ <dd className="text-zinc-300 tabular-nums text-right break-all">{v}</dd>+ </div>+ ))}+ </dl>+ <div className="mt-2 text-[10px] text-zinc-600 font-mono break-all select-all" title="track id">{t.id}</div>+ </section>+ </div>+ </aside>+ );+}diff --git a/web/src/components/TrackFeed.tsx b/web/src/components/TrackFeed.tsxindex bb698c2..5b1387e 100644--- a/web/src/components/TrackFeed.tsx+++ b/web/src/components/TrackFeed.tsx@@ -5,7 +5,9 @@ import { Music } from './Icons';interface Props {tracks: Track[];activeId: string | null;+ selectedId: string | null;playing: boolean;+ onSelect: (t: Track) => void;onPlay: (t: Track) => void;onDelete: (t: Track) => void;onReuse: (t: Track) => void;@@ -13,7 +15,7 @@ interface Props {emptyHint: string;}-export function TrackFeed({ tracks, activeId, playing, emptyHint, ...handlers }: Props) {+export function TrackFeed({ tracks, activeId, selectedId, playing, emptyHint, ...handlers }: Props) {if (tracks.length === 0) {return (<div className="h-full flex flex-col items-center justify-center text-center text-zinc-500 gap-3">@@ -27,7 +29,7 @@ export function TrackFeed({ tracks, activeId, playing, emptyHint, ...handlers }:return (<div className="flex flex-col gap-2">{tracks.map((t) => (- <TrackCard key={t.id} track={t} groupSize={groupSizes.get(t.groupId) ?? 1} active={t.id === activeId} playing={playing && t.id === activeId} {...handlers} />+ <TrackCard key={t.id} track={t} groupSize={groupSizes.get(t.groupId) ?? 1} active={t.id === activeId} selected={t.id === selectedId} playing={playing && t.id === activeId} {...handlers} />))}</div>);