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.

MOSS N7-1 fixes: hosted weights on a licence line of their own, cut notes open with More, guidance in halves, Canvas prices LoRA runs

Claudecba57cb8d0be
diff --git a/scripts/gen-cloud-models.py b/scripts/gen-cloud-models.py
index a1fd74f1..652dd85f 100644
--- a/scripts/gen-cloud-models.py
+++ b/scripts/gen-cloud-models.py
@@ -82,7 +82,8 @@ def model(id, name, vendor, family, kind, tagline, routes, badges=None, pricing=
sliders=None, controls=None, api_defaults=None, formats=None, ranged_durations=False, fit_values=False, fps_targets=None, upscale_tiers=None,
frame_step=None, original=False, sizes=None, keep_shape=False, licence=None, frame_fps=None, frame_multiple=None,
exact_size=False):
- """sliders / controls: [(field, label)] read from each route's research inputs (dotted = nested field):
+ """sliders / controls: [(field, label)] read from each route's research inputs (dotted = nested field; a slider's
+ third item is its step, when the generic one is too coarse):
numeric fields with minimum/maximum become sliders, enums become composer controls; both travel as params.extra.
fixed: fields always sent. api_defaults: fields sent unless the request sets them (FieldMap.defaults).
formats: {canonical VideoFormat: the API's value} for its output-format field (params.format), checked against the enum.
@@ -202,7 +203,7 @@ model("moss-image", "MOSS-Image", "OpenMOSS", "moss", "image",
"Clean Chinese and English text, and it follows layout boxes",
[("t2i", "fal-ai/moss-image", "fal", {"loraEndpoint": "fal-ai/moss-image/lora"})],
badges=["new"], defaults={"aspectRatio": "1:1"}, fixed={"output_format": "png"}, exact_size=True, options={"layout": "moss"},
- sliders=[("num_inference_steps", "Steps"), ("guidance_scale", "Guidance")],
+ sliders=[("num_inference_steps", "Steps"), ("guidance_scale", "Guidance", 0.5)],
licence={"licence": re.match(r"[\w.-]+", MOSS_FAL["license"]).group(0), "commercial": True,
"note": f"{MOSS_FAL['license']}. fal's safety checker returns a black image when it flags an output",
"checked": MOSS_FAL["fetched"]})
@@ -1348,12 +1349,13 @@ def time_field(key, spec):
return {"key": key, "type": t, **({"multiplier": 1000} if key.endswith("_ms") else {})}
-def add_slider(opts, param, label, spec):
+def add_slider(opts, param, label, spec, step=None):
if not spec or "minimum" not in spec or "maximum" not in spec or any(s["param"] == param for s in opts.get("sliders", [])):
return
lo, hi = spec["minimum"], spec["maximum"]
- # Narrow ranges (Topaz grain 0-0.1) get a step that still gives them about twenty stops.
- step = 1 if hi - lo > 4 else 0.05 if hi - lo > 0.2 else round((hi - lo) / 20, 4)
+ # Narrow ranges (Topaz grain 0-0.1) get a step that still gives them about twenty stops; a model line can name its own
+ # (MOSS-Image's guidance in halves, so 2.5, the GPU's Standard CFG, is one of them).
+ step = step or (1 if hi - lo > 4 else 0.05 if hi - lo > 0.2 else round((hi - lo) / 20, 4))
opts.setdefault("sliders", []).append({"param": param, "label": label, "min": lo, "max": hi, "step": step,
"default": spec.get("default", lo)})
@@ -1707,8 +1709,8 @@ def build_route(op, ep, provider, m, opts, ropts=None):
enum = (inputs.get(kf["targetLanguage"]) or {}).get("values")
opts["languages"] = enum or ISO_LANGUAGES
# The model's own slider/control labels win over the generic voice-setting labels below.
- for path, label in m.get("sliders") or []:
- add_slider(opts, path, label, spec_at(inputs, path))
+ for path, label, *step in m.get("sliders") or []:
+ add_slider(opts, path, label, spec_at(inputs, path), step[0] if step else None)
for path, label, *labels in m.get("controls") or []:
add_control(opts, path, label, spec_at(inputs, path), (m.get("api_defaults") or {}).get(path), labels[0] if labels else None)
for k, v in inputs.items():
diff --git a/src/components/model-access-view.tsx b/src/components/model-access-view.tsx
index 2162d390..103196d3 100644
--- a/src/components/model-access-view.tsx
+++ b/src/components/model-access-view.tsx
@@ -2,7 +2,7 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { Ban, CheckCircle2, CircleHelp, CreditCard, ExternalLink, FlaskConical, Globe, Info, RotateCcw, Search } from "lucide-react";
-import { Fragment, useDeferredValue, useMemo, useState } from "react";
+import { Fragment, useDeferredValue, useEffect, useMemo, useRef, useState } from "react";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
@@ -36,7 +36,46 @@ function ClassBadge({ licence }: { licence: LicenceInfo }) {
);
}
-function LicenceLine({ licence, prefix }: { licence: LicenceInfo; prefix?: string }) {
+const NOTE = "text-[12px] leading-relaxed text-muted-foreground [overflow-wrap:anywhere]";
+
+/**
+ * A licence note cut at two lines. When it is cut, "More" shows the rest: a tap or the keyboard reaches it, not only a
+ * mouse over the title.
+ */
+function ClampedNote({ text, about }: { text: string; about: string }) {
+ const ref = useRef<HTMLParagraphElement>(null);
+ const [open, setOpen] = useState(false);
+ const [cut, setCut] = useState(false);
+ useEffect(() => {
+ const el = ref.current;
+ if (!el || open) return;
+ // The observer answers once as it starts, then on every resize (a phone turned, the window narrowed).
+ const watch = new ResizeObserver(() => setCut(el.scrollHeight > el.clientHeight + 1));
+ watch.observe(el);
+ return () => watch.disconnect();
+ }, [open, text]);
+ return (
+ <div>
+ <p ref={ref} className={cn(NOTE, !open && "line-clamp-2")} title={open ? undefined : text}>
+ {text}
+ </p>
+ {(cut || open) && (
+ <button
+ type="button"
+ aria-expanded={open}
+ onClick={() => setOpen((o) => !o)}
+ className="inline-flex h-6 items-center rounded-sm text-[12px] font-medium text-foreground underline-offset-2 hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"
+ >
+ {open ? "Less" : "More"}
+ <span className="sr-only"> about {about}</span>
+ </button>
+ )}
+ </div>
+ );
+}
+
+/** `full`: the note is shown whole (a hosted model's weights line: short facts of its own), not cut at two lines. */
+function LicenceLine({ licence, prefix, full }: { licence: LicenceInfo; prefix?: string; full?: boolean }) {
return (
<div className="mt-1 space-y-0.5">
<p className="flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px]">
@@ -57,7 +96,7 @@ function LicenceLine({ licence, prefix }: { licence: LicenceInfo; prefix?: strin
</span>
))}
</p>
- {licence.note && <p className="line-clamp-2 text-[12px] leading-relaxed text-muted-foreground [overflow-wrap:anywhere]" title={licence.note}>{licence.note}</p>}
+ {licence.note && (full ? <p className={NOTE}>{licence.note}</p> : <ClampedNote text={licence.note} about={prefix ? `${prefix} ${licence.name}` : licence.name} />)}
</div>
);
}
@@ -100,6 +139,7 @@ function ModelRow({ m, on, onChange }: { m: ModelEntry; on: boolean; onChange: (
{m.hidden ? " · a helper step studios run" : ""}
</p>
<LicenceLine licence={m.licence} />
+ {m.weights && <LicenceLine licence={m.weights} prefix="Weights:" full />}
{m.cloud && <LicenceLine licence={m.cloud} prefix="In the cloud:" />}
{on && m.offBy.length > 0 && <p className="mt-1 text-[12px] font-medium text-warning">Not offered: {m.offBy.join(" and ")}</p>}
{on && m.partly.length > 0 && <p className="mt-1 text-[12px] text-muted-foreground">Partly: {m.partly.join(" and ")}, so it runs on what is still on</p>}
@@ -202,7 +242,7 @@ export function ModelAccessView() {
if (!data) return [];
const order = (c: LicenceClass) => LICENCE_CLASSES.indexOf(c);
return data.models
- .filter((m) => keep(!access!.models.includes(m.id) && !m.offBy.length) && matches(q, m.name, m.vendor, m.id, m.licence.name, m.licence.note, m.cloud?.name, CLASS_LABEL[m.licence.class]))
+ .filter((m) => keep(!access!.models.includes(m.id) && !m.offBy.length) && matches(q, m.name, m.vendor, m.id, m.licence.name, m.licence.note, m.cloud?.name, m.weights?.name, m.weights?.note, CLASS_LABEL[m.licence.class]))
.sort((a, b) => order(a.licence.class) - order(b.licence.class));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data, access, q, show]);
diff --git a/src/lib/catalog/canvas.ts b/src/lib/catalog/canvas.ts
index b9983a62..149c6e6b 100644
--- a/src/lib/catalog/canvas.ts
+++ b/src/lib/catalog/canvas.ts
@@ -1304,12 +1304,22 @@ export function describeNode(graph: CanvasGraph, n: CanvasNode, ctx: DescribeCon
// it can't wait for another node (said before Run).
const chained = plan.op === "keyframes" ? !!keyframeChain(plan.model) : routesFor(plan.model, plan.op).some((r) => r.chained);
if (built.deps.length && chained) return { ...built, model, costUsd: null, error: chainedWaitMessage(plan.model.name, plan.op) };
- return { ...built, model, plan, costUsd: estimateCost(plan.model, plan.params, plan.jobs, plan.op) };
+ return { ...built, model, plan, costUsd: planCost(plan) };
} catch (e) {
return { ...built, model, costUsd: null, error: (e as Error).message };
}
}
+/**
+ * A planned node's price, as the composer and the server work it out. A run with LoRAs (Fuobe Soul's look, a recipe's)
+ * goes to the route's LoRA endpoint at its own price, or an unknown one (fal's MOSS-Image /lora): null then, which the
+ * node shows as "Price unknown", never as free.
+ */
+function planCost(plan: Plan): number | null {
+ const withLoras = plan.loras.length > 0 && routesFor(plan.model, plan.op).some((r) => !!r.loraEndpoint);
+ return estimateCost(plan.model, plan.params, plan.jobs, plan.op, withLoras);
+}
+
/** A node made in several steps: every step planned with placeholders, the price their sum, the plan the last step's. */
function describeSteps(built: NodeRequest, model: ModelDef): NodeDescription {
let cost = 0;
@@ -1321,7 +1331,7 @@ function describeSteps(built: NodeRequest, model: ModelDef): NodeDescription {
} catch (e) {
return { ...built, model, costUsd: null, error: `${st.request.step?.label ?? st.key}: ${(e as Error).message}` };
}
- const c = estimateCost(plan.model, plan.params, plan.jobs, plan.op);
+ const c = planCost(plan);
if (c === null) unknown = true;
else cost += c;
}
diff --git a/src/lib/catalog/cloud-models.generated.ts b/src/lib/catalog/cloud-models.generated.ts
index 69a07691..f5a45b61 100644
--- a/src/lib/catalog/cloud-models.generated.ts
+++ b/src/lib/catalog/cloud-models.generated.ts
@@ -1720,7 +1720,7 @@ export const CLOUD_MODELS: ModelDef[] = [
"label": "Guidance",
"min": 0,
"max": 10,
- "step": 1,
+ "step": 0.5,
"default": 3
}
],
diff --git a/src/lib/model-access.ts b/src/lib/model-access.ts
index 68b9ae49..5e3ec681 100644
--- a/src/lib/model-access.ts
+++ b/src/lib/model-access.ts
@@ -232,6 +232,8 @@ export interface ModelEntry {
licence: LicenceInfo;
/** A Fuobe Original's cloud half (open weights hosted by fal or Replicate, under their terms). */
cloud?: LicenceInfo;
+ /** A hosted open model's weights (fal's MOSS-Image: Apache-2.0, and the host's catch), under the provider's terms. */
+ weights?: LicenceInfo;
packs: string[];
/** Its own switch. */
on: boolean;
diff --git a/src/server/model-access.ts b/src/server/model-access.ts
index 4eafabbc..0169e2b0 100644
--- a/src/server/model-access.ts
+++ b/src/server/model-access.ts
@@ -5,7 +5,7 @@ import { onEngine, providerEngine } from "@/lib/catalog/engines";
import { LORA_LIBRARY, MOTION_EFFECT_LORAS } from "@/lib/catalog/lora-library.generated";
import { libraryEntry, loraName } from "@/lib/catalog/loras";
import { OSS_LORAS, type OssLora } from "@/lib/catalog/oss-loras.generated";
-import type { Engine, LoraRef, ModelDef, ModelRoute } from "@/lib/catalog/types";
+import type { Engine, LoraRef, ModelDef, ModelLicence, ModelRoute } from "@/lib/catalog/types";
import type { ManifestWorkflow } from "@/lib/comfy";
import {
BROWSER_LICENCE,
@@ -21,6 +21,7 @@ import {
paidApiLicence,
PROVIDER_NAME,
workflowLicence,
+ type LicenceClass,
type LicenceInfo,
} from "@/lib/licences";
import {
@@ -253,8 +254,23 @@ export function offeredLoras(loras: LoraRef[]): { loras: LoraRef[]; notes: strin
const isOpenRoute = (r: ModelRoute) => providerEngine(r.provider) === "open";
-/** A model's licence as the list shows it: the open half names it, the cloud half is said beside it. */
-export function modelLicence(m: ModelDef): { licence: LicenceInfo; cloud?: LicenceInfo; packs: string[] } {
+/**
+ * The open weights a hosted model runs (fal's MOSS-Image, Replicate's FLUX dev LoRA builds), as their own line: their
+ * licence's name and class, and what the research noted about them and the host (fal's black-image safety checker).
+ * `commercial` from the research decides the class when the licence's name alone doesn't say.
+ */
+function weightsLicence(l: ModelLicence): LicenceInfo {
+ const info = licenceInfo(l.licence);
+ const cls: LicenceClass =
+ l.commercial === false ? (info.class === "research" ? "research" : "non-commercial") : l.commercial === null && info.class === "commercial" ? "conditions" : info.class;
+ return { ...info, class: cls, note: l.note?.trim() || l.licence };
+}
+
+/**
+ * A model's licence as the list shows it: the open half names it, the cloud half is said beside it. A hosted open model
+ * (only cloud routes, open weights recorded) also gets `weights`: the provider's terms name it, the weights' line follows.
+ */
+export function modelLicence(m: ModelDef): { licence: LicenceInfo; cloud?: LicenceInfo; weights?: LicenceInfo; packs: string[] } {
const open = m.routes.filter(isOpenRoute);
const cloud = m.routes.filter((r) => !isOpenRoute(r));
const packs = [...new Set(open.flatMap((r) => (r.provider === "comfyui" ? comfyFacts(r.endpoint).packs : [])))];
@@ -262,10 +278,8 @@ export function modelLicence(m: ModelDef): { licence: LicenceInfo; cloud?: Licen
const cloudRoutes = cloud.filter((r) => r.provider !== "llm");
const cloudLicence = cloudRoutes.length ? paidApiLicence(m.vendor, cloudRoutes) : cloud.length ? routeLicence(cloud[0], m) : undefined;
if (openLicence) return { licence: openLicence, ...(cloudLicence && { cloud: cloudLicence }), packs };
- // A hosted open model (fal's MOSS-Image) says what its weights are and what the research noted about the host.
- const stop = (t: string) => t.trim().replace(/\.?$/, ".");
- const weights = m.licence && cloudLicence?.class === "paid-api" ? ` Weights: ${stop(m.licence.note ?? m.licence.licence)}` : "";
- return { licence: cloudLicence ? { ...cloudLicence, note: weights ? `${stop(cloudLicence.note)}${weights}` : cloudLicence.note } : { name: "Not recorded", class: "unknown", note: "" }, packs };
+ if (!cloudLicence) return { licence: { name: "Not recorded", class: "unknown", note: "" }, packs };
+ return { licence: cloudLicence, ...(m.licence && cloudLicence.class === "paid-api" && { weights: weightsLicence(m.licence) }), packs };
}
/** The presets a map key names: a map v2 preset id, or a round-1 slug (the motion, effect or app it matches). */
@@ -327,7 +341,7 @@ export function knownSwitch(kind: "model" | "provider" | "pack" | "lora", id: st
export function accessList(): AccessList {
const access = readAccess();
const models: ModelEntry[] = MODELS.map((m) => {
- const { licence, cloud, packs } = modelLicence(m);
+ const { licence, cloud, weights, packs } = modelLicence(m);
const others = { ...access, models: access.models.filter((x) => x !== m.id) };
const off = m.routes.map((r) => routeOff(m, r, others, factsOf)).filter((s): s is NonNullable<typeof s> => !!s);
const labels = [...new Set(off.map(switchLabel))];
@@ -342,6 +356,7 @@ export function accessList(): AccessList {
providers: [...new Set(m.routes.map((r) => r.provider))],
licence,
...(cloud && { cloud }),
+ ...(weights && { weights }),
packs,
on: !access.models.includes(m.id),
offBy: all ? labels : [],
diff --git a/tests/canvas.test.ts b/tests/canvas.test.ts
index 28674798..0947b658 100644
--- a/tests/canvas.test.ts
+++ b/tests/canvas.test.ts
@@ -28,6 +28,7 @@ import {
type CanvasNode,
type CanvasRuns,
} from "@/lib/catalog/canvas";
+import { estimateCost } from "@/lib/catalog/plan";
import type { GenerationStatus, Operation } from "@/lib/catalog/types";
const node = (id: string, type: CanvasNode["type"], x: number, y: number, data: CanvasNode["data"] = {}): CanvasNode => ({ id, type, position: { x, y }, data });
@@ -492,3 +493,21 @@ describe("round-4 models on the canvas", () => {
expect(modelChoices({ type: "model", data: { mediaKind: "model3d" } }).map((m) => m.id)).not.toContain("meshy-rigging");
});
});
+
+describe("canvas prices with LoRAs", () => {
+ // A node whose run loads LoRAs goes to the route's LoRA endpoint, at its own price (or an unknown one, never free):
+ // the canvas prices it as the composer and the server do (N7-1 review).
+ it("prices Fuobe Soul's look LoRAs at the LoRA endpoint's rate", () => {
+ const g: CanvasGraph = { nodes: [node("s", "model", 0, 0, { modelId: "fuobe-soul", prompt: "a cat on a windowsill" })], edges: [] };
+ const d = describeNode(g, g.nodes[0], { engineMode: "cloud" });
+ expect(d.plan!.loras.length).toBeGreaterThan(0);
+ const p = d.plan!;
+ expect(d.costUsd).toBe(estimateCost(p.model, p.params, p.jobs, p.op, true));
+ expect(d.costUsd).toBeGreaterThan(estimateCost(p.model, p.params, p.jobs, p.op)!);
+ });
+
+ it("leaves a model without LoRAs at its own price", () => {
+ const g: CanvasGraph = { nodes: [node("m", "model", 0, 0, { modelId: "moss-image", prompt: "a neon OPEN sign" })], edges: [] };
+ expect(describeNode(g, g.nodes[0]).costUsd).toBe(0.05);
+ });
+});
diff --git a/tests/e2e/moss-image.mjs b/tests/e2e/moss-image.mjs
index ec17cc77..0ce6af7f 100644
--- a/tests/e2e/moss-image.mjs
+++ b/tests/e2e/moss-image.mjs
@@ -1,7 +1,10 @@
// N7-1 in the browser (no run reaches a GPU or fal): MOSS-Image in the Image studio's model menu on both engines with its
// price ($0.05 per megapixel in the cloud; "on your GPU, about 13 GB of files" and Free on the open engine), its Quality
-// setting under Options reached by keyboard, and both rows in Settings → Models & licences with their switches on. Each
-// page at 1440 and 390 px, light and dark, without sideways scroll.
+// setting under Options reached by keyboard (on a phone, Options sits in the Settings sheet), and both rows in Settings →
+// Models & licences with their switches on and their licence facts on screen (the cloud row's weights and fal's
+// black-image catch shown whole; a cut note opened with "More" from the keyboard). A LoRA run's price is unknown, never
+// free (the preview API: no picker attaches a LoRA to MOSS yet). Each page at 1440 and 390 px, light and dark, without
+// sideways scroll.
// Usage: FAL_KEY=anything pnpm dev, then node tests/e2e/moss-image.mjs [appUrl] [--shots <dir>] (with a fal key the
// cloud price shows instead of "Demo · free"; nothing is sent: Generate is never pressed). Exits 1 on a failed check.
import fs from "node:fs";
@@ -45,6 +48,20 @@ const openStudio = async (page) => {
};
try {
+ // A LoRA run goes to fal's /lora twin, whose price isn't published: unknown (null), never free.
+ const preview = async (loras) =>
+ (
+ await fetch(`${app}/api/generations?preview=1`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ feature: "image", modelId: "moss-image", op: "t2i", prompt: 'A neon sign that reads "OPEN"', ...(loras && { loras }) }),
+ })
+ ).json();
+ const plain = await preview();
+ const withLora = await preview([{ file: "moss-style.safetensors", url: "https://huggingface.co/example/moss-style/resolve/main/moss-style.safetensors", strength: 0.8 }]);
+ check("api: a plain MOSS-Image run is priced at $0.05 (1024 × 1024)", plain.costUsd === 0.05, JSON.stringify(plain.costUsd));
+ check("api: a MOSS-Image run with a LoRA goes to /lora at an unknown price, not free", withLora.costUsd === null && withLora.route?.endpoint === "fal-ai/moss-image/lora", `${JSON.stringify(withLora.costUsd)} ${withLora.route?.endpoint ?? withLora.error ?? ""}`);
+
for (const width of [1440, 390]) {
for (const scheme of ["light", "dark"]) {
const tag = `${width} ${scheme}`;
@@ -83,13 +100,24 @@ try {
check(`${tag} ${engine}: the composer now runs MOSS-Image`, /MOSS-Image/.test(t), t.slice(0, 100));
const price = engine === "open" ? /\bFree\b/ : fal ? /≈ \$0\.05\b/ : /Demo/;
check(`${tag} ${engine}: its price shows before the run`, price.test(t), (t.match(/Demo · free|Demo|≈ \$[\d.]+|\bFree\b/) ?? ["no price"])[0]);
- if (engine === "open" && width === 1440) {
- // Quality under Options, from the keyboard.
- const options = composer(page).getByRole("button", { name: /^Options/ }).first();
+ if (engine === "open") {
+ // Quality under Options, from the keyboard; on a phone Options is in the Settings sheet (a popover in a sheet).
+ let scope = composer(page);
+ if (width < 500) {
+ const settings = composer(page).getByRole("button", { name: /^Settings:/ }).first();
+ await settings.focus();
+ await page.keyboard.press("Enter");
+ scope = page.getByRole("dialog").first();
+ await scope.waitFor({ timeout: 10_000 });
+ }
+ const options = scope.getByRole("button", { name: /^Options/ }).first();
await options.focus();
+ check(`${tag} open: the keyboard reaches Options`, await options.evaluate((el) => el === document.activeElement));
await page.keyboard.press("Enter");
const quality = page.getByRole("combobox", { name: "Quality" });
await quality.waitFor({ timeout: 10_000 });
+ const qbox = await quality.boundingBox();
+ check(`${tag} open: Quality fits the screen`, !!qbox && qbox.x >= 0 && qbox.x + qbox.width <= width + 1, qbox ? `${Math.round(qbox.x)}+${Math.round(qbox.width)}` : "no box");
check(`${tag} open: Options shows Quality, Auto = Standard · 25 steps`, /Auto · Standard · 25 steps/.test(flat(await quality.innerText())), flat(await quality.innerText()));
await quality.focus();
await page.keyboard.press("Enter");
@@ -97,9 +125,15 @@ try {
await best.waitFor({ timeout: 10_000 });
const opts = flat(await page.getByRole("listbox").innerText());
check(`${tag} open: Quality offers Best · 50 steps and Fast · 8 steps`, /Best · 50 steps/.test(opts) && /Fast · 8 steps/.test(opts), opts);
+ // The keyboard picks Best (arrows to it, Enter); the setting says so.
+ for (let i = 0; i < 6 && (await best.getAttribute("data-highlighted")) === null; i++) await page.keyboard.press("ArrowDown");
+ await page.keyboard.press("Enter");
+ await page.waitForTimeout(300);
+ check(`${tag} open: Best picked from the keyboard`, /Best · 50 steps/.test(flat(await quality.innerText())), flat(await quality.innerText()));
await shoot(page, `moss-options-${width}-${scheme}.png`);
await page.keyboard.press("Escape");
await page.keyboard.press("Escape");
+ if (width < 500) await page.keyboard.press("Escape");
}
check(`${tag} ${engine}: no sideways scroll on the Image studio`, await noSideways(page));
await shoot(page, `moss-image-${engine}-${width}-${scheme}.png`);
@@ -113,15 +147,31 @@ try {
await find.waitFor({ timeout: 60_000 });
await find.fill("MOSS");
await page.waitForTimeout(800);
- for (const [id, want] of [
- ["oss-moss-image", /Apache-2\.0/],
- ["moss-image", /Paid API · fal\.ai[\s\S]*safety checker returns a black image/],
+ for (const [id, want, fact] of [
+ ["oss-moss-image", /Apache-2\.0/, /Spectrallic's MOSS-Image SFT 8-step DMD int8 file, Apache-2\.0/],
+ ["moss-image", /Paid API · fal\.ai[\s\S]*Weights: Apache-2\.0/, /safety checker returns a black image/],
]) {
const sw = page.locator(`#model-${id}`);
await sw.waitFor({ timeout: 15_000 });
- const rowText = flat(await sw.locator("xpath=ancestor::li[1]").innerText());
- const titles = flat(await sw.locator("xpath=ancestor::li[1]").evaluate((li) => [...li.querySelectorAll("[title]")].map((e) => e.getAttribute("title")).join(" ")));
- check(`${tag} settings: ${id} is listed with its licence`, want.test(`${rowText} ${titles}`), rowText.slice(0, 140));
+ const row = sw.locator("xpath=ancestor::li[1]");
+ const rowText = flat(await row.innerText());
+ check(`${tag} settings: ${id} is listed with its licence`, want.test(rowText), rowText.slice(0, 140));
+ // The fact is on screen, not only in a hover title: a note cut at two lines opens with "More" from the keyboard.
+ const more = row.getByRole("button", { name: /^More/ });
+ if (await more.count()) {
+ await more.first().focus();
+ await page.keyboard.press("Enter");
+ await page.waitForTimeout(200);
+ check(`${tag} settings: ${id}'s cut note opens from the keyboard`, (await row.getByRole("button", { name: /^Less/ }).first().getAttribute("aria-expanded")) === "true");
+ }
+ const shown = await row.evaluate((li, src) => {
+ const re = new RegExp(src);
+ const p = [...li.querySelectorAll("p")].find((e) => re.test(e.textContent ?? ""));
+ if (!p) return "missing";
+ const r = p.getBoundingClientRect();
+ return p.scrollHeight <= p.clientHeight + 1 && r.width > 0 && r.right <= window.innerWidth + 1 ? "shown" : `cut (${p.scrollHeight} > ${p.clientHeight})`;
+ }, fact.source);
+ check(`${tag} settings: ${id}'s ${fact.source.slice(0, 40)}… is on screen`, shown === "shown", shown);
check(`${tag} settings: ${id} starts on`, (await sw.getAttribute("aria-checked")) === "true" || (await sw.getAttribute("data-state")) === "checked");
// Keyboard: Space flips it, Space flips it back.
await sw.focus();
diff --git a/tests/moss-image.test.ts b/tests/moss-image.test.ts
index 6780ec32..646d8d36 100644
--- a/tests/moss-image.test.ts
+++ b/tests/moss-image.test.ts
@@ -47,11 +47,17 @@ describe("moss-image on fal", () => {
expect(m.fixed).toEqual({ output_format: "png" });
expect(BASE.inputs.num_images).toMatchObject({ minimum: 1, maximum: 4 });
expect(cloud.options.maxOutputs).toBe(4);
- // Steps and guidance are fal's own fields, with fal's range and default.
+ // Steps and guidance are fal's own fields, with fal's range and default; guidance (a float) moves in halves, so the
+ // GPU's Standard CFG 2.5 can be asked for in the cloud too.
expect(cloud.options.sliders).toEqual([
{ param: "num_inference_steps", label: "Steps", min: 1, max: 100, step: 1, default: 50 },
- { param: "guidance_scale", label: "Guidance", min: 0, max: 10, step: 1, default: 3 },
+ { param: "guidance_scale", label: "Guidance", min: 0, max: 10, step: 0.5, default: 3 },
]);
+ expect(BASE.inputs.guidance_scale.type).toBe("number");
+ const guidance = cloud.options.sliders!.find((x) => x.param === "guidance_scale")!;
+ for (const set of Object.values(open.options.controls!.find((c) => c.param === "quality")!.sets!)) {
+ expect(Number.isInteger((Number(set.cfg) - guidance.min) / guidance.step), `cfg ${set.cfg}`).toBe(true);
+ }
expect(BASE.inputs.num_inference_steps).toMatchObject({ minimum: 1, maximum: 100, default: 50 });
expect(BASE.inputs.guidance_scale).toMatchObject({ minimum: 0, maximum: 10, default: 3 });
// LoRAs go through the /lora twin: up to 3 of {path, scale 0-4}.
@@ -154,7 +160,26 @@ describe("Settings → Models & licences", () => {
expect(o.packs).toEqual([]);
const c = modelLicence(cloud);
expect(c.licence).toMatchObject({ class: "paid-api", name: "Paid API · fal.ai" });
- expect(c.licence.note).toMatch(/Weights: Apache-2\.0 weights \(OpenMOSS-Team\/MOSS-Image-SFT\); hosted under fal's terms\. fal's safety checker returns a black image when it flags an output\.$/);
+ // The weights and the host's catch are a line of their own (shown whole at 390 px), not the end of the paid-API note.
+ expect(c.licence.note).not.toMatch(/Weights|safety checker/);
+ expect(c.weights).toEqual({
+ name: "Apache-2.0",
+ class: "commercial",
+ url: "https://spdx.org/licenses/Apache-2.0.html",
+ note: "Apache-2.0 weights (OpenMOSS-Team/MOSS-Image-SFT); hosted under fal's terms. fal's safety checker returns a black image when it flags an output",
+ });
+ expect(o.weights).toBeUndefined();
+ });
+
+ it("names a hosted model's weights by their licence, its class from the research where the name doesn't say", () => {
+ const w = (id: string) => modelLicence(getModel(id)!).weights;
+ // Was "Weights: Weights are non-commercial; …" at the end of the paid-API note.
+ expect(w("flux-1-dev-lora-cloud")).toMatchObject({ name: "FLUX.1 [dev] Non-Commercial License", class: "non-commercial" });
+ expect(w("flux-2-klein-9b-lora-cloud")).toMatchObject({ class: "non-commercial" });
+ expect(w("ltx-2-3-22b-cloud")).toMatchObject({ name: "LTX-2 Community License", class: "conditions" });
+ // A closed model has no weights line; a Fuobe Original's open half names its licence as before.
+ expect(w("nano-banana-pro")).toBeUndefined();
+ expect(modelLicence(getModel("fuobe-soul")!).weights).toBeUndefined();
});
it("lists both, switched on", () => {