The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Merge round 5, part 3: Kandinsky 6.0, Pika H3 Flex, Green screen, Edit speech, 3D splats, World mode
Adarsh1255a9908bde
diff --cc src/lib/hubs.tsindex 1a057ab3,da1ea7a8..6c0a7e67--- a/src/lib/hubs.ts+++ b/src/lib/hubs.ts@@@ -34,8 -32,10 +34,9 @@@ export const HUB_MODES: Record<HubKind{ id: "dialogue", label: "Dialogue" },{ id: "voice-change", label: "Voice change" },{ id: "design", label: "Design a voice" },+ { id: "edit-speech", label: "Edit speech", selfHostedOnly: true },{ id: "translate", label: "Translate", selfHostedOnly: true },{ id: "transcribe", label: "Transcribe" },- { id: "clean", label: "Clean up voice" },{ id: "split", label: "Split soundtrack", selfHostedOnly: true },{ id: "sfx", label: "Sound effects" },{ id: "music", label: "Music" },diff --cc src/lib/palette-index.tsindex 12e06947,6dfd19d5..09ecd628--- a/src/lib/palette-index.ts+++ b/src/lib/palette-index.ts@@@ -50,7 -53,9 +53,9 @@@ const MODEL_STUDIOS: [string, StudioCon["/reframe", REFRAME_STUDIO],["/upscale", UPSCALE_STUDIO],["/upscale/video", VIDEO_UPSCALE_STUDIO],+ ["/upscale/fps", FPS_BOOST_STUDIO],+ ["/upscale/hdr", SDR_TO_HDR_STUDIO],- ["/audio", AUDIO_STUDIO],+ ["/audio/speech", AUDIO_STUDIO],["/audio/dialogue", DIALOGUE_STUDIO],["/audio/voice-change", VOICE_CHANGE_STUDIO],["/audio/transcribe", TRANSCRIBE_STUDIO],diff --cc src/server/db.tsindex 5301c583,c9c32c3c..c645bf3d--- a/src/server/db.ts+++ b/src/server/db.ts@@@ -1064,14 -1071,13 +1071,19 @@@ function open(): Database.Database}// Admin tokens and the admin API's log.db.exec(ADMIN_TABLES);- // Skills: the runs that wait across studios.+ // Skills: the runs that wait across studios. A data folder that ran claude/fuobe-parity-4's earlier build of this+ // feature (its numbered migration at place 27, a skill_runs with no engine column and runs kept in another shape)+ // keeps that table under another name, so these runs start from an empty table. Nothing is deleted.+ if (skillRunsFromEarlierBuild(db)) {+ db.exec("DROP INDEX IF EXISTS skill_runs_skill; DROP INDEX IF EXISTS skill_runs_status; ALTER TABLE skill_runs RENAME TO skill_runs_earlier;");+ }db.exec(SKILL_TABLES);+ // An account's own canvases (account-canvas.ts): not a numbered migration, so branches never clash over its place.+ db.exec(ACCOUNT_CANVAS_TABLES);+ // Its list reads this small summary, never every board's pages (a table made before it had the column gets it).+ if (!(db.prepare("PRAGMA table_info(account_canvases)").all() as { name: string }[]).some((c) => c.name === "summary_json")) {+ addColumn(db, "ALTER TABLE account_canvases ADD COLUMN summary_json TEXT");+ }// A billing hold's rows are found through this index (only rows that have one are in it).try {db.exec("CREATE INDEX IF NOT EXISTS generations_hold ON generations(json_extract(request_json, '$.hold')) WHERE json_extract(request_json, '$.hold') IS NOT NULL");diff --cc tests/nav-bar.test.tsindex fe22ec7c,65afc717..d6e9a32f--- a/tests/nav-bar.test.ts+++ b/tests/nav-bar.test.ts@@@ -174,8 -174,8 +174,8 @@@ describe("the launcher's columns", () =expect(subs("marketing")).toEqual(["Click to Ad", "Ads Studio", "Ad Multiplier"]);expect(subs("genjutsu")).toEqual(["Motion transfer", "Character swap", "Object swap", "Restyle", "Insert"]);expect(subs("upscale")).toEqual(["Image", "Video", "FPS Boost", "SDR to HDR", "Export"]);- expect(subs("audio")).toEqual(["Speech", "Dialogue", "Voice change", "See all 13"]);- expect(subs("video-tools")).toEqual(["Relight", "Captions", "Remove object", "See all 10"]);- expect(subs("audio")).toEqual(["Dialogue", "Voice change", "Design a voice", "See all 14"]);++ expect(subs("audio")).toEqual(["Speech", "Dialogue", "Voice change", "See all 14"]);+ expect(subs("video-tools")).toEqual(["Relight", "Captions", "Remove object", "See all 11"]);for (const w of ["Click to Ad", "Ads Studio", "Ad Multiplier", "Motion transfer", "FPS Boost"]) expect(words(html)).toContain(w);// Under a hairline, quieter than a row, with no picture and no line of their own (nav-subs.css: 24 px// names with a mouse, 44 px pills to tap on a touch screen).diff --cc tests/speech-edit-server.test.tsindex 00000000,ad39d837..7677cfc3mode 000000,100644..100644--- a/tests/speech-edit-server.test.ts+++ b/tests/speech-edit-server.test.ts@@@ -1,0 -1,215 +1,215 @@@+ import fs from "node:fs";+ import os from "node:os";+ import path from "node:path";+ import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";+ import { NextRequest } from "next/server";++ /**+ * Edit speech on the server (nm10-speech-edit): POST /api/audio-tools tool "speech-edit" in demo mode, the open-engine+ * rule (Engine mode "Paid APIs only" refuses it), the public sign-up rules for its price check and run, Assist / MCP's+ * edit_speech, the ⋯ menu's link, the licence row and the GPU pre-flight board's row.+ */++ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-speech-edit-server-"));+ process.env.FUOBE_DATA_DIR = dir;+ process.env.COMFYUI_URL = "http://127.0.0.1:9";+ process.env.OLLAMA_URL = "http://127.0.0.1:9";+ delete process.env.FUOBE_PASSWORD;+ delete process.env.FUOBE_PUBLIC_SIGNUP;+ const auth = await import("@/server/auth");+ const { proxy } = await import("@/proxy");+ const { setSetting } = await import("@/server/settings");+ const { saveFile } = await import("@/server/storage");+ const gens = await import("@/server/generations");+ const route = await import("@/app/api/audio-tools/route");+ const { STUDIO_ROWS, studioOthers, studioTool } = await import("@/server/gpu/tools");+ const { outputActions } = await import("@/lib/output-actions");+ const { getModel } = await import("@/lib/catalog");+ const { NODE_PACKS, licenceInfo } = await import("@/lib/licences");+ const { handleMcp } = await import("@/server/mcp");++ beforeAll(() => setSetting("demoMode", "on"));+ afterEach(() => {+ delete process.env.FUOBE_PUBLIC_SIGNUP;+ setSetting("engineMode", "both");+ });+ afterAll(() => {+ try {+ fs.rmSync(dir, { recursive: true, force: true });+ } catch {}+ });++ function wav(name = "take.wav", accountId?: string, seconds = 9): string {+ const rate = 8000;+ const n = rate * seconds;+ const b = Buffer.alloc(44 + n * 2);+ b.write("RIFF", 0);+ b.writeUInt32LE(36 + n * 2, 4);+ b.write("WAVEfmt ", 8);+ b.writeUInt32LE(16, 16);+ b.writeUInt16LE(1, 20);+ b.writeUInt16LE(1, 22);+ b.writeUInt32LE(rate, 24);+ b.writeUInt32LE(rate * 2, 28);+ b.writeUInt16LE(2, 32);+ b.writeUInt16LE(16, 34);+ b.write("data", 36);+ b.writeUInt32LE(n * 2, 40);+ return saveFile({ data: b, contentType: "audio/wav", name, source: "upload", ...(accountId && { accountId }) }).url;+ }++ const CUES = [+ { start: 0.2, end: 2.4, text: "We open the new studio" },+ { start: 3, end: 4.8, text: "on Tuesday morning." },+ { start: 5.5, end: 8.6, text: "Everyone is welcome to come along." },+ ];+ const body = (media: string, extra: Record<string, unknown> = {}) => ({ tool: "speech-edit", engine: "open", media, kind: "audio", name: "Take", cues: CUES, edited: [CUES[0].text, "on Thursday morning.", CUES[2].text], ...extra });+ function call(url: string, b: unknown, cookie?: string) {+ return new Request(`http://localhost:3000${url}`, { method: "POST", headers: { "Content-Type": "application/json", ...(cookie && { cookie: `${auth.SESSION_COOKIE}=${cookie}` }) }, body: JSON.stringify(b) });+ }++ describe("POST /api/audio-tools speech-edit (demo mode)", () => {+ it("prices a word edit as free on your GPU and runs it into the Library as one track", async () => {+ const media = wav();+ const p = await (await route.POST(call("/api/audio-tools?preview=1", body(media)))).json();+ expect(p).toMatchObject({ steps: 1, costUsd: 0, demo: true });+ expect(p.summary).toMatch(/re-spoken by AuK in the same voice/);+ const res = await route.POST(call("/api/audio-tools", body(media)));+ expect(res.status).toBe(201);+ const run = await res.json();+ expect(run.result).toMatchObject({ modelId: "oss-auk", op: "speech-edit", feature: "speech-edit" });+ expect(run.result.request.params.extra.speechWindows[0].instruction).toBe("Replace 'Tuesday' with 'Thursday'.");+ const deadline = Date.now() + 15_000;+ let g = gens.getGeneration(run.result.id)!;+ while (g.status !== "succeeded" && g.status !== "failed" && Date.now() < deadline) {+ await new Promise((r) => setTimeout(r, 200));+ g = gens.getGeneration(run.result.id)!;+ }+ expect(g.status).toBe("succeeded");+ expect(g.outputs.filter((o) => o.kind === "audio")).toHaveLength(1);+ }, 30_000);++ it("prices an effect on a range, and says what's missing in words", async () => {+ const media = wav();+ const fx = await (await route.POST(call("/api/audio-tools?preview=1", body(media, { edited: undefined, range: { start: 0, end: 4.8 }, effect: { kind: "pitch", semitones: 2 } })))).json();+ expect(fx).toMatchObject({ steps: 1, costUsd: 0 });+ const same = await route.POST(call("/api/audio-tools?preview=1", body(media, { edited: CUES.map((c) => c.text) })));+ expect(same.status).toBe(422);+ expect((await same.json()).error).toMatch(/Nothing changed/);+ const odd = await route.POST(call("/api/audio-tools?preview=1", body(media, { edited: undefined, range: { start: 0, end: 4 }, effect: { kind: "pitch", semitones: 7 } })));+ expect(odd.status).toBe(400);+ expect((await odd.json()).error).toBe("Pick one of the offered settings for the effect");+ const none = await route.POST(call("/api/audio-tools?preview=1", { ...body(media), cues: [] }));+ expect((await none.json()).error).toBe("Transcribe the recording first, then edit its lines");+ });++ it("runs on your GPU only: the cloud engine and Paid APIs only say so", async () => {+ const media = wav();+ const cloud = await route.POST(call("/api/audio-tools?preview=1", body(media, { engine: "cloud" })));+ expect(cloud.status).toBe(422);+ expect((await cloud.json()).error).toMatch(/runs on your GPU \(open source\): AuK isn't hosted on fal or Replicate/);+ setSetting("engineMode", "cloud");+ const paid = await route.POST(call("/api/audio-tools?preview=1", body(media)));+ expect((await paid.json()).error).toMatch(/set to paid cloud APIs only/);+ });++ it("a video gets its new sound back on the picture", async () => {+ const media = wav("clip.wav");+ const p = await (await route.POST(call("/api/audio-tools?preview=1", body(media, { kind: "video" })))).json();+ expect(p.steps).toBe(2);+ expect(p.notes.join(" ")).toMatch(/Lipsync/);+ });+ });++ describe("public sign-up", () => {+ const passed = (r: Response) => r.headers.get("x-middleware-next") === "1";+ const req = (url: string, cookie?: string) =>+ new NextRequest(`http://localhost:3000${url}`, { method: "POST", headers: cookie ? { cookie: `${auth.SESSION_COOKIE}=${cookie}` } : {}, body: "{}" });+ let n = 0;+ const newAccount = () => auth.createAccount(`speech${++n}@example.com`, "long enough");++ it("prices a visitor's edit on its own GPU, never a demo, and only of its own file; the run is own-gpu-tool for an account", async () => {+ process.env.FUOBE_PUBLIC_SIGNUP = "1";+ auth.setPassword("install password");+ const who = newAccount();+ const cookie = auth.createSession(who.id).value;+ // Through the sign-in proxy: the price check passes, the run is refused as a tool (it would use the studio's GPU).+ expect(passed(proxy(req("/api/audio-tools?preview=1", cookie)))).toBe(true);+ const run = proxy(req("/api/audio-tools", cookie));+ expect(run.status).toBe(403);+ expect((await run.json()).code).toBe("own-gpu-tool");+ // The owner's file answers a guest and an account as one that's gone.+ const owners = wav("owners.wav");+ for (const c of [undefined, cookie]) {+ const r = await route.POST(call("/api/audio-tools?preview=1", body(owners), c));+ expect(r.status).toBe(422);+ expect((await r.json()).error).toBe("That recording is gone — add it again");+ }+ const mine = await route.POST(call("/api/audio-tools?preview=1", body(wav("mine.wav", who.id)), cookie));+ expect(await mine.json()).toMatchObject({ steps: 1, costUsd: 0, demo: false });+ });+ });++ describe("Assist and MCP's edit_speech", () => {+ const rpc = (method: string, params?: unknown) => handleMcp({ jsonrpc: "2.0", id: 1, method, params });+ const args = (media: string) => ({ media, kind: "audio", transcript: CUES, changes: [{ line: 1, text: "on Thursday morning." }] });++ it("is listed with its schema, priced with estimate_job and runs as a pipeline in demo mode", async () => {+ const list = (await rpc("tools/list")) as { result: { tools: { name: string; inputSchema: { properties: Record<string, unknown>; required: string[] }; description: string }[] } };+ const t = list.result.tools.find((x) => x.name === "edit_speech")!;+ expect(t).toBeTruthy();+ expect(Object.keys(t.inputSchema.properties).sort()).toEqual(["changes", "effect", "kind", "media", "quality", "range", "transcript"]);+ expect(t.inputSchema.required.sort()).toEqual(["kind", "media", "transcript"]);+ expect(t.description).toMatch(/estimate_job/);+ const media = wav();+ const est = (await rpc("tools/call", { name: "estimate_job", arguments: { tool: "edit_speech", arguments: args(media) } })) as { result: { structuredContent: { jobs: { modelId: string; op: string; error?: string }[] } } };+ expect(est.result.structuredContent.jobs).toMatchObject([{ modelId: "oss-auk", op: "speech-edit" }]);+ expect(est.result.structuredContent.jobs[0].error).toBeUndefined();+ const out = (await rpc("tools/call", { name: "edit_speech", arguments: args(media) })) as { result: { isError: boolean; content: { text: string }[] } };+ expect(out.result.isError).toBe(false);+ expect(JSON.parse(out.result.content[0].text).steps).toHaveLength(1);+ // An effect with a value AuK doesn't take is refused on the card.+ const bad = (await rpc("tools/call", { name: "estimate_job", arguments: { tool: "edit_speech", arguments: { media, kind: "audio", transcript: CUES, effect: { kind: "pitch", semitones: 9 }, range: { start: 0, end: 4 } } } })) as {+ result: { structuredContent: { jobs: { error?: string }[] } };+ };+ expect(bad.result.structuredContent.jobs[0].error).toMatch(/semitones/);+ });+ });++ describe("where Edit speech shows up", () => {+ it("in the ⋯ menu of speech results, never in Paid APIs only, and not on music", () => {+ const g = (op: string, kind: "audio" | "video", feature = "studio") =>+ ({ id: "g", op, feature, status: "succeeded", favorite: false, engine: "open", request: { modelId: "m", op }, outputs: [{ url: "/api/files/x.wav", kind }] }) as never;+ const has = (x: ReturnType<typeof outputActions>) => x.find((a) => a.id === "edit-speech");+ expect(has(outputActions(g("tts", "audio"), 0))?.href).toBe(`/audio/edit-speech?audio=${encodeURIComponent("/api/files/x.wav")}`);+ expect(has(outputActions(g("music", "audio"), 0))).toBeUndefined();+ expect(has(outputActions(g("tts", "audio"), 0, { engineMode: "cloud" }))).toBeUndefined();+ expect(has(outputActions(g("lipsync", "video"), 0))?.href).toMatch(/^\/audio\/edit-speech\?video=/);+ // A guest or an account (public sign-up) can't run it: the edit runs on a self-hosted Fuobe only.+ expect(has(outputActions(g("tts", "audio"), 0, { visitor: true }))).toBeUndefined();+ expect(has(outputActions(g("lipsync", "video"), 0, { visitor: true }))).toBeUndefined();+ });++ it("has its model, licence and a row on the GPU pre-flight board", () => {+ const m = getModel("oss-auk")!;+ expect(m.routes.map((r) => [r.op, r.endpoint])).toEqual([+ ["speech-edit", "speech-edit-auk"],+ ["tts", "speech-tts-auk"],+ ]);+ expect(NODE_PACKS.find((p) => p.name === "ComfyUI-AuK")?.licence).toMatchObject({ name: "MIT", class: "commercial" });+ // The encoder's licence links to its own model's licence, not another Qwen model's.+ expect(licenceInfo("AuK code and weights MIT (Tencent); its Qwen2.5-Omni-3B encoder Qwen Research License (NON-COMMERCIAL)")).toMatchObject({+ name: "Qwen Research License",+ class: "non-commercial",+ url: "https://huggingface.co/Qwen/Qwen2.5-Omni-3B/blob/main/LICENSE",+ });+ expect(licenceInfo("Qwen Research License (NON-COMMERCIAL)").url).toMatch(/Qwen-Image-2\.1/);+ const row = STUDIO_ROWS.find((r) => r.href === "/audio/edit-speech")!;+ expect(row).toMatchObject({ label: "Edit speech", group: "Audio" });+ expect(studioTool(row)!.workflows).toEqual(expect.arrayContaining(["speech-edit-auk"]));+ // AuK's text to speech is one of Voice's other open models, on the board with its own graph, and its picker line names its languages.- const voice = STUDIO_ROWS.find((r) => r.href === "/audio")!;++ const voice = STUDIO_ROWS.find((r) => r.href === "/audio/speech")!;+ expect(studioOthers(voice).find((t) => t.workflows.includes("speech-tts-auk"))).toBeTruthy();+ expect(m.tagline).toMatch(/English and Chinese/);+ });+ });