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.

Model picker: a visitor's switch keeps to icons on a phone, Cloud wording

Adarsh42f97fe21b27
diff --git a/src/components/studio/model-picker.tsx b/src/components/studio/model-picker.tsx
index 5353cc23..655b430b 100644
--- a/src/components/studio/model-picker.tsx
+++ b/src/components/studio/model-picker.tsx
@@ -24,7 +24,7 @@ import { cn } from "@/lib/utils";
import { ownSetupLabel } from "@/lib/own-setup";
import { answerPickModel } from "@/lib/pick-model";
import { addKeyLabel, billedTo, CLOUD_KEY, CLOUD_PROVIDERS, needsKey, type CloudProvider } from "@/lib/your-keys";
-import { CLOUD_SECTION_LABEL, cloudModelAsk, openCloudPanel, visitorEngine } from "@/lib/engine-ux";
+import { CLOUD_PICKER_NOTE, CLOUD_SECTION_LABEL, cloudModelAsk, openCloudPanel, visitorEngine } from "@/lib/engine-ux";
import { EngineSwitch } from "./engine-switch";
import { ResponsivePanel } from "./responsive-panel";
import { RECENT_MODELS, STARRED_MODELS, useStoredList } from "./stored-list";
@@ -395,7 +395,8 @@ export function PickerList({
<div className="min-w-0 flex-1 [&_[data-slot=command-input-wrapper]]:p-0">
<CommandInput value={q} onValueChange={setQ} placeholder={mobile ? "Search" : mode === "both" ? "Search all models" : "Search models"} aria-label="Search models" autoFocus={!mobile} />
</div>
- <EngineSwitch value={engine} onChange={onEngineChange} size="sm" />
+ {/* A visitor's two-line switch keeps to its icons on a phone, so the search field keeps its room. */}
+ <EngineSwitch value={engine} onChange={onEngineChange} size="sm" compact={hostedVisitor || undefined} />
</div>
<div className="flex items-baseline gap-x-2 px-3 pb-1.5 leading-snug text-[11px] text-muted-foreground sm:px-3.5">
<span className="shrink-0 whitespace-nowrap tabular-nums">
@@ -416,7 +417,7 @@ export function PickerList({
<>
<span aria-hidden>·</span>
<span className="min-w-0">
- Paid models like Nano Banana and Kling need your own fal.ai or Replicate key ·{" "}
+ {hostedVisitor ? CLOUD_PICKER_NOTE : "Paid models like Nano Banana and Kling need your own fal.ai or Replicate key"} ·{" "}
{guest ? (
<button
type="button"
diff --git a/src/lib/engine-ux.ts b/src/lib/engine-ux.ts
index 9426dbf1..0f67a4cf 100644
--- a/src/lib/engine-ux.ts
+++ b/src/lib/engine-ux.ts
@@ -86,6 +86,9 @@ export const engineHintText = (place: Place) => ({
/** The picker's section of Cloud models for a visitor without a key. */
export const CLOUD_SECTION_LABEL = "Cloud · your key";
+/** The picker's line above its list for a visitor without a key. */
+export const CLOUD_PICKER_NOTE = "Cloud models like Nano Banana and Kling run on your own fal.ai or Replicate key";
+
/** Where the browser remembers that an account closed the hint: one key per account (its email, hashed). */
export function engineHintKey(email: string): string {
let h = 5381;
diff --git a/tests/engine-ux.test.ts b/tests/engine-ux.test.ts
index 71e3683a..1e6d5286 100644
--- a/tests/engine-ux.test.ts
+++ b/tests/engine-ux.test.ts
@@ -177,6 +177,9 @@ describe("the model picker", () => {
expect(text.indexOf(open.name)).toBeLessThan(text.indexOf(ux.CLOUD_SECTION_LABEL));
expect(text.indexOf(ux.CLOUD_SECTION_LABEL)).toBeLessThan(text.indexOf(cloud.name));
expect(html).toContain(`aria-label="${cloud.name} needs your fal.ai key"`);
+ expect(text).toContain(ux.CLOUD_PICKER_NOTE);
+ // Its own switch keeps to icons on a phone (the search field keeps its room).
+ expect(html).toMatch(/data-engine-switch="visitor"[\s\S]*class="hidden sm:inline">Open source</);
expect(ux.cloudModelAsk(state.status)).toBe("panel");
});
@@ -190,6 +193,7 @@ describe("the model picker", () => {
state.status = hostedStatus({ hosted: false, placeName: undefined });
const text = textOf(list());
expect(text).toContain("Paid models · with your own key");
+ expect(text).toContain("Paid models like Nano Banana and Kling need your own fal.ai or Replicate key");
expect(text).not.toContain(ux.CLOUD_SECTION_LABEL);
});
});
@@ -218,7 +222,7 @@ describe("the words", () => {
expect(ux.addProviderKeyLabel("replicate")).toBe("Add a Replicate key");
expect(`${hint.lead} ${hint.rest}`).toBe(`Free open-source models run on ${place.text}. Want frontier models? Switch to Cloud with your own key.`);
expect(ux.engineCaption.open(place)).toBe(`Free · ${place.label}`);
- const all = [...Object.values(panel), ...Object.values(hint), ux.engineCaption.open(place), ux.engineCaption.cloud, ux.CLOUD_KEYLESS_TIP, ux.CLOUD_SECTION_LABEL, ...ux.CLOUD_SHOWCASE.map((s) => s.why)];
+ const all = [...Object.values(panel), ...Object.values(hint), ux.engineCaption.open(place), ux.engineCaption.cloud, ux.CLOUD_KEYLESS_TIP, ux.CLOUD_SECTION_LABEL, ux.CLOUD_PICKER_NOTE, ...ux.CLOUD_SHOWCASE.map((s) => s.why)];
for (const w of all) {
expect(w, w).not.toMatch(FORBIDDEN);
// Short sentences: none over 25 words.