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.

Restore 6: the Hugging Face token setting is huggingfaceToken

Claudeb84bc019df9b
diff --git a/src/app/api/loras/route.ts b/src/app/api/loras/route.ts
index 56b151f8..2da83a88 100644
--- a/src/app/api/loras/route.ts
+++ b/src/app/api/loras/route.ts
@@ -22,7 +22,7 @@ export const GET = handler({ access: "signed-in" }, async () => {
folder: folder || null,
...(problem && { folderProblem: problem }),
civitaiKey: !!getSetting("civitaiKey"),
- hfToken: !!getSetting("hfToken"),
+ hfToken: !!getSetting("huggingfaceToken"),
loras: LORA_LIBRARY.map((e) => ({
key: e.key,
name: e.name,
diff --git a/src/components/lora-settings.tsx b/src/components/lora-settings.tsx
index 783638c5..ec6e9cde 100644
--- a/src/components/lora-settings.tsx
+++ b/src/components/lora-settings.tsx
@@ -242,7 +242,7 @@ export function LoraSettings({ folder, civitaiKey, hfToken }: { folder?: PublicS
/>
<ConnectField
id="huggingface"
- name="hfToken"
+ name="huggingfaceToken"
setting={hfToken}
provider="huggingface"
label="Hugging Face token"
diff --git a/src/components/settings-form.tsx b/src/components/settings-form.tsx
index 232da801..9bbf25dd 100644
--- a/src/components/settings-form.tsx
+++ b/src/components/settings-form.tsx
@@ -339,7 +339,7 @@ export function SettingsForm({ prices }: { prices?: string }) {
title="LoRAs · looks, motions, effects and adapters"
description="Looks, camera moves and effects add LoRA files to open models, on your GPU and in the cloud; an adapter is the LoRA an Original always loads (Fuobe Try-On's). Fuobe fetches the pinned version a run needs and shows each file's licence; what may run where is your call in Models & licences."
>
- <LoraSettings folder={get("comfyLorasDir")} civitaiKey={get("civitaiKey")} hfToken={get("hfToken")} />
+ <LoraSettings folder={get("comfyLorasDir")} civitaiKey={get("civitaiKey")} hfToken={get("huggingfaceToken")} />
</Section>
<Section
diff --git a/src/lib/connections.ts b/src/lib/connections.ts
index 466b8937..c561bd68 100644
--- a/src/lib/connections.ts
+++ b/src/lib/connections.ts
@@ -15,7 +15,7 @@ export const PROVIDER_SETTINGS = {
// Not a model provider: the key that downloads a recipe's civitai LoRAs (Settings → LoRAs).
civitai: ["civitaiKey"],
// Nor this: the token that downloads gated Hugging Face LoRAs once their licence is accepted (Settings → LoRAs).
- huggingface: ["hfToken"],
+ huggingface: ["huggingfaceToken"],
// Not a model provider either: the trainer Soul IDs and Fuobe looks train on, on your GPU (Settings → Training).
"ai-toolkit": ["aiToolkitUrl", "aiToolkitToken", "aiToolkitDatasetDir"],
} as const satisfies Record<TestProvider, readonly string[]>;
diff --git a/src/server/loras.ts b/src/server/loras.ts
index 5d95953e..423cab08 100644
--- a/src/server/loras.ts
+++ b/src/server/loras.ts
@@ -108,7 +108,7 @@ function recordCopy(c: Omit<LoraCopy, "createdAt">): void {
const civitaiKey = () => getSetting("civitaiKey");
/** The Hugging Face token (Settings or HF_TOKEN): used only to download gated Hugging Face files. */
-const hfToken = () => getSetting("hfToken");
+const hfToken = () => getSetting("huggingfaceToken");
/** Whether a Hugging Face token is set (gated downloads need one). */
export const hasHfToken = (): boolean => !!hfToken();
diff --git a/src/server/settings.ts b/src/server/settings.ts
index bee26985..86d7d047 100644
--- a/src/server/settings.ts
+++ b/src/server/settings.ts
@@ -41,7 +41,7 @@ export const SETTINGS = {
* Hugging Face access token: downloads the LoRAs of gated Hugging Face repos (Lightricks' Restore and Detail Refine
* IC-LoRAs) once their licence is accepted with that account. Used for nothing else; never sent to fal or Replicate.
*/
- hfToken: { key: "huggingface.token", env: "HF_TOKEN", secret: true },
+ huggingfaceToken: { key: "huggingface.token", env: "HF_TOKEN", secret: true },
/** AI-Toolkit UI (ostris/ai-toolkit, port 8675) for open-source character LoRA training. */
aiToolkitUrl: { key: "aitk.url", env: "AI_TOOLKIT_URL" },
aiToolkitToken: { key: "aitk.token", env: "AI_TOOLKIT_AUTH", secret: true },
diff --git a/tests/lora-fetch.test.ts b/tests/lora-fetch.test.ts
index a000d97c..a96be0b0 100644
--- a/tests/lora-fetch.test.ts
+++ b/tests/lora-fetch.test.ts
@@ -308,14 +308,14 @@ describe("Before a cloud run", () => {
expect(fitted.notes).toEqual([]);
expect(lorasFit({ provider: "replicate", map: { loras: { shape: "single", weights: "w", scale: "s" } } }, [relight, fpv])).toBe(false);
// No token: refused by name, with where to accept the licence and where the token goes; nothing is fetched.
- setSetting("hfToken", "");
+ setSetting("huggingfaceToken", "");
net = network({});
await expect(prepareCloudLoras([relight], "fal", upload().fn)).rejects.toThrow(/gated Hugging Face repo: accept its licence on https:\/\/huggingface\.co\/Lightricks\/LTX-2\.3-22b-IC-LoRA-Relight .*Settings → LoRAs/);
expect(net.calls).toEqual([]);
net.restore();
// With the token: downloaded once with it (Authorization to huggingface.co, never in a URL), copied to fal, recorded.
const HF = "hf_secret0123456789abcdef";
- setSetting("hfToken", HF);
+ setSetting("huggingfaceToken", HF);
const body = Buffer.from("relight".repeat(64));
const pinned = { ...relight, file: relight.file };
net = network({ [loraEntry("ltx-2-3-22b-ic-lora-relight-1-0")!.url]: () => new Response(new Uint8Array(body), { status: 200, headers: { "content-length": String(body.length) } }) });
@@ -327,7 +327,7 @@ describe("Before a cloud run", () => {
expect(get.url).not.toContain(HF);
expect(up.sent).toEqual([]);
expect(redact(`failed with ${HF}`)).toBe("failed with •••");
- setSetting("hfToken", "");
+ setSetting("huggingfaceToken", "");
});
it("mirrors the pinned bytes, not a same-named file of other bytes in the LoRA folder", async () => {