Skip to content

Suno-style web UI for a self-hosted MiniMax-Music3 inference server

fix: random titles never pair a word with itself; single ETA sign

Adam Benhassen7c2a1650f384
diff --git a/server/src/names.ts b/server/src/names.ts
index 2e8536a..9048a87 100644
--- a/server/src/names.ts
+++ b/server/src/names.ts
@@ -23,9 +23,12 @@ const pick = <T,>(arr: T[], rnd: () => number) => arr[Math.floor(rnd() * arr.len
/** A random two-word song title, e.g. "Velvet Horizon". `rnd` is injectable for tests. */
export function randomTitle(rnd: () => number = Math.random): string {
+ const next = (w: string) => NOUNS[(NOUNS.indexOf(w) + 1) % NOUNS.length];
const a = pick(ADJECTIVES, rnd);
- const n = pick(NOUNS, rnd);
+ let n = pick(NOUNS, rnd);
+ if (n === a) n = next(n); // a few words ("Static", "Sunday") are in both lists
let n2 = pick(NOUNS, rnd);
- if (n2 === n) n2 = NOUNS[(NOUNS.indexOf(n) + 1) % NOUNS.length];
+ if (n2 === n || n2 === a) n2 = next(n2 === n ? n : n2);
+ if (n2 === n) n2 = next(n2);
return pick(PATTERNS, rnd)(a, n, n2);
}
diff --git a/server/test/names.test.ts b/server/test/names.test.ts
index e315acd..37927db 100644
--- a/server/test/names.test.ts
+++ b/server/test/names.test.ts
@@ -14,4 +14,12 @@ describe('randomTitle', () => {
expect(new Set(words).size).toBe(words.length);
}
});
+ it('never pairs an adjective with the same word as noun ("Static Static")', () => {
+ // ADJECTIVES[31] = 'Static' (31.5/40), NOUNS[20] = 'Static' (20.5/40); pattern 0 = "a n"
+ const seq = [31.5 / 40, 20.5 / 40, 20.5 / 40, 0];
+ let i = 0;
+ const t = randomTitle(() => seq[i++]);
+ expect(t.split(' ')[0]).toBe('Static');
+ expect(t.split(' ')[1]).not.toBe('Static');
+ });
});
diff --git a/web/src/components/ProgressDetail.tsx b/web/src/components/ProgressDetail.tsx
index 2afe8cd..196b914 100644
--- a/web/src/components/ProgressDetail.tsx
+++ b/web/src/components/ProgressDetail.tsx
@@ -38,7 +38,7 @@ export function ProgressDetail({ track: t }: { track: Track }) {
{!indeterminate && <span className="text-zinc-300">{info.real ? '' : '~'}{pct}%</span>}
{info.real && (t.renderedSeconds ?? 0) > 0 && <span title="audio rendered so far">{fmtTime(t.renderedSeconds!)} / {fmtTime(t.duration)} rendered</span>}
{typeof t.elapsed === 'number' && t.elapsed > 0 && <span title="elapsed">{fmtTime(t.elapsed)} elapsed</span>}
- {t.eta !== null && t.eta > 0 && !indeterminate && <span title="estimated remaining" className="text-zinc-300">≈ {fmtEta(t.eta)}</span>}
+ {t.eta !== null && t.eta > 0 && !indeterminate && <span title="estimated remaining" className="text-zinc-300">{fmtEta(t.eta)}</span>}
</span>
</div>
</div>