Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(settings): HF-Token-Hinweis im MLX-Installationsweg

purplecf1d1c57252b
diff --git a/src/components/settings/MlxMediaSettings.tsx b/src/components/settings/MlxMediaSettings.tsx
index 72e5bd5a..c32f2222 100644
--- a/src/components/settings/MlxMediaSettings.tsx
+++ b/src/components/settings/MlxMediaSettings.tsx
@@ -10,7 +10,7 @@
// while something runs instead of holding progress in React.
import { useCallback, useEffect, useRef, useState } from 'react'
-import { Cpu, Download, Trash2, Loader2, Check, AlertTriangle, Film, Image as ImageIcon } from 'lucide-react'
+import { Cpu, Download, Trash2, Loader2, Check, AlertTriangle, Film, Image as ImageIcon, KeyRound } from 'lucide-react'
import {
mlxStatus,
listMlxImageModels,
@@ -262,6 +262,22 @@ export function MlxMediaSettings({ only }: { only?: 'image' | 'video' } = {}) {
</div>
)}
+ {/* F4 (301-Liste): the models below download from huggingface.co, and
+ nothing on this install path said a token helps before the fix. The
+ Hub itself is slower and rate-limited for anonymous requests; four
+ fresh comparison numbers were the ask, but measuring those needs a
+ real Hugging Face token, which this build did not create (no
+ credential is read or entered here). So this line stays without a
+ number, true and short, and the numbers are tracked as open in the
+ build report instead of invented. */}
+ <div className="flex items-start gap-2 p-2.5 rounded-lg border border-gray-200 dark:border-white/8 bg-gray-50 dark:bg-white/[0.03]">
+ <KeyRound size={13} className="mt-0.5 shrink-0 text-gray-500" />
+ <div className="t-micro leading-relaxed text-gray-600 dark:text-gray-400">
+ These models download from Hugging Face. Anonymous downloads can be slower or rate limited;
+ a free Hugging Face token avoids that. Add one under Hugging Face token in AI Backends.
+ </div>
+ </div>
+
{/* ── Image ─────────────────────────────────────────── */}
{showImage && (<>
<div className="flex items-center gap-1.5 pt-1">
diff --git a/src/components/settings/__tests__/mlx-hf-token-hint.test.tsx b/src/components/settings/__tests__/mlx-hf-token-hint.test.tsx
new file mode 100644
index 00000000..5db6a776
--- /dev/null
+++ b/src/components/settings/__tests__/mlx-hf-token-hint.test.tsx
@@ -0,0 +1,87 @@
+/**
+ * @vitest-environment jsdom
+ *
+ * F4 (DIE-301-LISTE.md / proof/1-engine-modelle.md): the MLX install path
+ * pulls models straight from huggingface.co and, before this fix, said
+ * nothing about a token helping. This pins the hint text on that path AND
+ * that it stays off the sibling ComfyUI panel (the only OTHER local-media
+ * install surface, shown instead of this one on non-Mac hosts, see
+ * SettingsPage.tsx's `isMlxImageHost()` branch): a hint that leaked onto a
+ * download path that never talks to huggingface.co with the app's own
+ * apply_hf_token flow would be worse than none, it would point the user at
+ * a setting that does not apply there.
+ *
+ * The four comparison numbers the list also asks for (with/without token,
+ * with/without HF_HUB_DISABLE_XET=1) need a real Hugging Face token against
+ * the live Hub; this build did not create or read one (no credential
+ * handling here), so the hint text carries no number and the measurement
+ * stays open, see bau/w2lane.md.
+ *
+ * Run: npx vitest run src/components/settings/__tests__/mlx-hf-token-hint.test.tsx
+ */
+import { describe, it, expect, afterEach, vi } from 'vitest'
+import { createElement } from 'react'
+import { render, screen, cleanup } from '@testing-library/react'
+import { readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+
+vi.mock('../../../api/mlx-image', () => ({
+ mlxStatus: vi.fn().mockResolvedValue({ installed: false, running: false, port: 0 }),
+ listMlxImageModels: vi.fn().mockResolvedValue([]),
+ installMlxImageModel: vi.fn(),
+ getMlxImageInstallStatus: vi.fn(),
+ deleteMlxImageModel: vi.fn(),
+ installMlxImageEngine: vi.fn(),
+ getMlxImageEngineStatus: vi.fn(),
+}))
+vi.mock('../../../api/mlx-video', () => ({
+ getVideoStatus: vi.fn().mockResolvedValue({
+ available: false, appleSilicon: true, mlxInstalled: false, mlxVersion: null,
+ pythonBin: null, modelsRoot: '', outputsRoot: '', installedModels: [], running: false,
+ }),
+ listVideoModels: vi.fn().mockResolvedValue([]),
+ installMlxVideo: vi.fn(),
+ getMlxInstallStatus: vi.fn(),
+ installVideoModel: vi.fn(),
+ getModelInstallStatus: vi.fn(),
+ deleteVideoModel: vi.fn(),
+}))
+
+import { MlxMediaSettings } from '../MlxMediaSettings'
+
+afterEach(cleanup)
+
+const HINT = /Anonymous downloads can be slower or rate limited/i
+
+describe('F4: der HF-Token-Hinweis im MLX-Installationsweg', () => {
+ it('erscheint im MLX-Medienpanel', async () => {
+ render(createElement(MlxMediaSettings))
+ expect(await screen.findByText(HINT)).toBeTruthy()
+ })
+
+ it('nennt keine Zahl, das Messen blieb offen (kein Token in diesem Bau)', async () => {
+ render(createElement(MlxMediaSettings))
+ const node = await screen.findByText(HINT)
+ expect(node.textContent).not.toMatch(/\d/)
+ })
+
+ it('GEGENPROBE: der Hinweis steht NICHT im ComfyUI-Panel, dem einzigen anderen lokalen Medien-Installationsweg', () => {
+ // Strukturell statt gerendert: `ComfyUISettings` lebt als eigene
+ // Funktion in SettingsPage.tsx (kein eigenes Modul) und zieht ein
+ // eigenes Geflecht an Backend-Zustand mit, das hier nicht aufgebaut
+ // werden soll. Der Quelltext der Funktion selbst beantwortet die Frage
+ // robust genug: "steht der MLX-Text (oder ein Verweis auf Hugging Face)
+ // auch hier". ComfyUI installiert nie von huggingface.co, sondern von
+ // der ComfyUI-Registry/Civitai, der Hinweis waere dort schlicht falsch.
+ const seite = readFileSync(resolve(__dirname, '..', 'SettingsPage.tsx'), 'utf-8')
+ const zeilen = seite.split('\n')
+ const start = zeilen.findIndex((z) => z.startsWith('export function ComfyUISettings'))
+ expect(start).toBeGreaterThan(-1)
+ // Naechste Funktion auf oberster Ebene beendet den Ausschnitt.
+ const endeRelativ = zeilen.slice(start + 1).findIndex((z) => /^(export )?function [A-Za-z]/.test(z))
+ const quelle = zeilen.slice(start, start + 1 + endeRelativ).join('\n')
+
+ expect(quelle).not.toMatch(HINT)
+ expect(quelle).not.toMatch(/huggingface/i)
+ })
+})