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.

Originals O2: Soul HEX locks a palette on the open engine by default

Claudee8bb8621f685
diff --git a/src/app/api/palettes/lock/route.ts b/src/app/api/palettes/lock/route.ts
index 888e8e55..53931544 100644
--- a/src/app/api/palettes/lock/route.ts
+++ b/src/app/api/palettes/lock/route.ts
@@ -7,6 +7,9 @@ const Hex = z.string().regex(/^#?[0-9a-fA-F]{6}$/);
const RequestSchema = z.object({
feature: z.string().min(1).max(80),
presetId: z.string().max(120).optional(),
+ // A Fuobe Soul look's strength, and the engine an Original runs on (the lock itself is the open engine's).
+ presetStrength: z.number().min(0).max(1).optional(),
+ engine: z.enum(["open", "cloud"]).optional(),
modelId: z.string().min(1).max(120),
op: z.string().max(40).optional(),
prompt: z.string().max(10_000).optional(),
diff --git a/src/components/palettes/color-signature-panel.tsx b/src/components/palettes/color-signature-panel.tsx
index 47718bf7..72415842 100644
--- a/src/components/palettes/color-signature-panel.tsx
+++ b/src/components/palettes/color-signature-panel.tsx
@@ -122,7 +122,18 @@ function FromImages({ files, setFiles, onSaved }: { files: File[]; setFiles: (f:
* The Color signature panel: saved palettes (yours, then Cinema Studio's 50) as cards, Upload &
* Create (colours extracted from up to 20 photos) and Pick colors manually.
*/
-export function ColorSignaturePanel({ value, onPick, engine }: { value?: PalettePick; onPick: (p?: PalettePick) => void; engine: "cloud" | "open" }) {
+export function ColorSignaturePanel({
+ value,
+ onPick,
+ engine,
+ lockByDefault = false,
+}: {
+ value?: PalettePick;
+ onPick: (p?: PalettePick) => void;
+ engine: "cloud" | "open";
+ /** The model locks the colours unless it's turned off (Fuobe Soul's HEX on the open engine). */
+ lockByDefault?: boolean;
+}) {
const { items, isLoading } = usePalettes();
const { create, remove } = usePaletteActions();
const [view, setView] = useState<View>("list");
@@ -176,7 +187,7 @@ export function ColorSignaturePanel({ value, onPick, engine }: { value?: Palette
Lock the colours after generating
<span className="block text-[11.5px] text-muted-foreground">A palette-transfer step recolours each image (open source, CPU)</span>
</span>
- <Switch checked={!!value.lock} onCheckedChange={(lock) => onPick({ ...value, lock })} aria-label="Lock the colours after generating" />
+ <Switch checked={value.lock ?? lockByDefault} onCheckedChange={(lock) => onPick({ ...value, lock })} aria-label="Lock the colours after generating" />
</label>
)}
<div className="max-h-[52svh] space-y-4 overflow-y-auto pr-0.5 sm:max-h-[360px]" onScroll={(e) => setCompact(e.currentTarget.scrollTop > 24)}>
diff --git a/src/components/palettes/signature-chips.tsx b/src/components/palettes/signature-chips.tsx
index 2d004d86..c076c43e 100644
--- a/src/components/palettes/signature-chips.tsx
+++ b/src/components/palettes/signature-chips.tsx
@@ -53,6 +53,7 @@ export default function SignatureChips({
value,
onChange,
engine,
+ lockByDefault,
presetSource,
styleId,
onStyleIdTaken,
@@ -60,6 +61,8 @@ export default function SignatureChips({
value: Signature | undefined;
onChange: (update: (s: Signature | undefined) => Signature) => void;
engine: Engine;
+ /** The model locks a picked palette unless it's turned off (Fuobe Soul's HEX on the open engine). */
+ lockByDefault?: boolean;
/** The model's own preset list (options.presets.source): the Moodboard panel opens on it ("soul-v1" = Soul's styles). */
presetSource?: string;
/** A Soul `style_id` in the draft's settings (a reused Soul run): shown and kept as the Moodboard pick. */
@@ -100,6 +103,7 @@ export default function SignatureChips({
<ColorSignaturePanel
value={pal}
engine={engine}
+ lockByDefault={lockByDefault}
onPick={(p) => {
onChange((s) => ({ ...s, palette: p }));
// Toggling the lock keeps the panel open; picking a palette closes it.
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsx
index 24e5d0a5..0c70cb77 100644
--- a/src/components/studio/composer.tsx
+++ b/src/components/studio/composer.tsx
@@ -12,6 +12,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip
import { estimateCost, planGeneration, routesFor } from "@/lib/catalog/plan";
import type { Engine, GenerationRequest, MediaKind, ModelDef, Operation, Preset, VideoFormat } from "@/lib/catalog/types";
import { dualEngine } from "@/lib/catalog/engines";
+import { locksByDefault } from "@/lib/catalog/palettes";
import { formatsOf } from "@/lib/av/formats";
import { enhance, useClipFacts, useCreateGeneration, useElements, useEngine, useHydrated, useStatus } from "@/lib/api";
import { applyMentions, type StudioElement } from "@/lib/catalog/elements";
@@ -618,6 +619,7 @@ export function Composer({ docked }: { docked: boolean }) {
value={draft.signature}
onChange={(update) => setDraft((d) => ({ signature: update(d.signature) }))}
engine={engine}
+ lockByDefault={locksByDefault(model?.id)}
presetSource={opts.presets?.source}
styleId={soulStyles ? (p.extra?.[opts.presets!.param] as string | undefined) : undefined}
onStyleIdTaken={() => setExtra(opts.presets!.param, undefined)}
diff --git a/src/lib/catalog/palettes.ts b/src/lib/catalog/palettes.ts
index 3d9e3e79..05e0c73c 100644
--- a/src/lib/catalog/palettes.ts
+++ b/src/lib/catalog/palettes.ts
@@ -382,6 +382,13 @@ export interface SignedRequest {
lock?: { colors: string[] };
}
+/**
+ * Fuobe Soul's HEX palette (Soul, Soul HD, Soul Cinema): the colours in the prompt on both engines, and on the open
+ * engine the palette lock after it unless it was turned off (research §4.4: the lock is the open engine's HEX; fal has
+ * no colour-match step). Other open models lock only when asked.
+ */
+export const locksByDefault = (modelId: string | undefined): boolean => !!modelId && (Object.values(SOUL_MODEL_IDS) as string[]).includes(modelId);
+
/** Models a signature can move a request to; studios that offer the chips keep them in their model slice. */
export const SIGNATURE_MODELS = {
cloudRefs: "nano-banana-pro",
@@ -564,7 +571,7 @@ export function applySignature(req: GenerationRequest, sig: Signature | undefine
} else {
words.push(palettePrompt(pal));
r = { ...r, params: { ...r.params, palette: all.slice(0, 16) } };
- if (model.engine === "open" && pal.lock) {
+ if (model.engine === "open" && (pal.lock ?? locksByDefault(model.id))) {
lock = { colors: all };
notes.push(`Then recoloured to “${pal.name}” by a palette-transfer step`);
}
diff --git a/tests/soul-runs.test.ts b/tests/soul-runs.test.ts
index c21901e7..16778945 100644
--- a/tests/soul-runs.test.ts
+++ b/tests/soul-runs.test.ts
@@ -208,3 +208,53 @@ describe("Fuobe Soul through the server", () => {
setSetting("engineMode", "both");
});
});
+
+describe("Soul HEX: a palette on Fuobe Soul", () => {
+ const PAL = { id: "p1", name: "Teal Dusk", colors: ["#102030", "#2A9D8F"], background: "#264653", slug: null };
+ const signed = async (engine: "open" | "cloud", modelId = "fuobe-soul", lock?: boolean) => {
+ const { applySignature } = await import("@/lib/catalog/palettes");
+ const { signatureCaps } = await import("@/server/palettes");
+ // The composer's catalog is the engine's view of each model.
+ const view = (id: string) => {
+ const m = getModel(id);
+ return m && onEngine(m, engine);
+ };
+ return applySignature({ feature: "image", modelId, prompt: "a lighthouse at dusk", presetId: "v1-90s-grain", engine }, { palette: { ...PAL, ...(lock !== undefined && { lock }) } }, { caps: signatureCaps(), getModel: view });
+ };
+
+ it("writes the colours into the prompt on both engines and locks them on the open engine unless turned off", async () => {
+ const open = await signed("open");
+ expect(open.modelId).toBe("fuobe-soul");
+ expect(open.request.presetId).toBe("v1-90s-grain");
+ expect(open.request.signature?.words).toMatch(/^Color palette: use only these colors.*#102030, #2A9D8F; background color #264653\.$/);
+ expect(open.lock).toEqual({ colors: ["#102030", "#2A9D8F", "#264653"] });
+ expect((await signed("open", "fuobe-soul-cinema")).lock).toBeTruthy();
+ expect((await signed("open", "fuobe-soul", false)).lock).toBeUndefined();
+ // fal has no colour-match step: the cloud gets the words only.
+ const cloud = await signed("cloud");
+ expect(cloud.lock).toBeUndefined();
+ expect(cloud.request.signature?.words).toMatch(/Color palette/);
+ // Other open models still lock only when asked.
+ expect((await signed("open", "oss-qwen-image")).lock).toBeUndefined();
+ });
+
+ it("puts the palette's words inside the look's prompt, and the lock keeps the look's strength and engine", async () => {
+ const open = await signed("open");
+ const p = previewGeneration(open.request);
+ expect(p.prompt).toMatch(/a lighthouse at dusk\. Color palette: use only these colors/);
+ const { POST } = await import("@/app/api/palettes/lock/route");
+ const res = await POST(
+ new Request("http://localhost/api/palettes/lock", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ request: { ...open.request, presetStrength: 0.6 }, colors: open.lock!.colors }),
+ }),
+ );
+ expect(res.status).toBe(201);
+ const { items } = (await res.json()) as { items: { modelId: string; engine: string; request: { presetId?: string; presetStrength?: number; engine?: string } }[] };
+ const first = items.find((g) => g.modelId === "fuobe-soul")!;
+ expect(first.request).toMatchObject({ presetId: "v1-90s-grain", presetStrength: 0.6, engine: "open" });
+ expect(first.engine).toBe("open");
+ expect(items.some((g) => g.modelId === "oss-palette-image")).toBe(true);
+ });
+});