Skip to content

armgit / fuobe

Public Imported from GitHub
0

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.

Composer: Run on an item that needs the account's own setup moves it there and says so

Adarshc5e77b5a7efb
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsx
index 5aa32594..895a7ac1 100644
--- a/src/components/studio/composer.tsx
+++ b/src/components/studio/composer.tsx
@@ -23,7 +23,7 @@ import { poolRunState, quoteBody, useHostedQuote, useSettled, type RunOn } from
import { composerOnPool, composerPlace } from "@/lib/run-place";
import { PoolNote } from "./pool-note";
import { modelOwnSetup, poolRunsModel } from "@/lib/pool-rules";
-import { controlSetup, keyOnlySetup } from "@/lib/own-setup-controls";
+import { controlSetup, keyOnlySetup, movedToOwnText } from "@/lib/own-setup-controls";
import { ownSetupDetail, ownSetupLabel, ownSetupShort } from "@/lib/own-setup";
import { OwnSetupChip, useOwnSetupPress, useOwnSetupViewer } from "@/components/own-setup";
import { HoldFilesCtx } from "@/lib/held-files";
@@ -835,12 +835,16 @@ export function Composer({ docked }: { docked: boolean }) {
}
if (keyToAdd && model && !create.isPending) return openAddKey(keyToAdd, model.id);
if (!blocker && gpuSetup && !skipGpu && !create.isPending) return openGpuFix();
- // Refused by the price check (Run is off; Enter in the prompt lands here too): its words, and nothing is sent.
+ // It runs on the visitor's own setup: Run opens it (Connect your GPU, Add your key, a guest's sign-up), and nothing
+ // is sent. An account that has it (its own GPU, or the key that runs it) is moved there, to run with the next press.
if (!blocker && poolSetup) {
- // An account that has the setup (its own GPU, or the key that runs it) runs it there.
- if (pressSetup(poolSetup)) setRunOn("own");
+ if (pressSetup(poolSetup)) {
+ setRunOn("own");
+ toast(movedToOwnText(!!viewerInfo?.gpu.connected), { id: "composer-blocker" });
+ }
return;
}
+ // Refused by the price check (Run is off; Enter in the prompt lands here too): its words, and nothing is sent.
if (!blocker && poolRefused && poolState) return void toast(poolState.text, { id: "composer-blocker" });
if (blocker || create.isPending || signature.lock.isPending) {
if (blocker) {
diff --git a/src/lib/own-setup-controls.ts b/src/lib/own-setup-controls.ts
index 18db7158..8df61ea1 100644
--- a/src/lib/own-setup-controls.ts
+++ b/src/lib/own-setup-controls.ts
@@ -20,3 +20,11 @@ export function keyOnlySetup(m: { id: string; engine: string } | undefined, engi
const o = m ? ownSetupOnly(m.id, m.engine === "cloud" ? "cloud" : engine) : null;
return o?.need === "key" ? o : null;
}
+
+/**
+ * Said when Run moves an account's draft to its own setup (a refused price check on this install's GPUs, for an account
+ * that has the GPU or key that runs it): where the next press runs it.
+ */
+export function movedToOwnText(gpuConnected: boolean): string {
+ return gpuConnected ? "Switched to your GPU. Press Run to start." : "Switched to your key. Press Run to start.";
+}
diff --git a/tests/own-setup-labels.test.ts b/tests/own-setup-labels.test.ts
index 1b87a3d9..ec5fabbc 100644
--- a/tests/own-setup-labels.test.ts
+++ b/tests/own-setup-labels.test.ts
@@ -218,3 +218,12 @@ describe("a cloud model a visitor runs on its own key only", () => {
expect(keyOnlySetup(undefined, "open")).toBeNull();
});
});
+
+describe("Run on an item this install's GPUs don't run, for an account that has the setup", () => {
+ it("says where the next press runs it, in plain words", async () => {
+ const { movedToOwnText } = await import("@/lib/own-setup-controls");
+ expect(movedToOwnText(true)).toBe("Switched to your GPU. Press Run to start.");
+ expect(movedToOwnText(false)).toBe("Switched to your key. Press Run to start.");
+ for (const said of [movedToOwnText(true), movedToOwnText(false)]) expect(said).not.toMatch(REASON);
+ });
+});