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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
test: add model pipeline tests, fix flux2 registry
PurpleDoubleD06a985735ddf
diff --git a/package-lock.json b/package-lock.jsonindex e574807d..356cf4c8 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "locally-uncensored",- "version": "1.5.3",+ "version": "1.5.5","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "locally-uncensored",- "version": "1.5.3",+ "version": "1.5.5","license": "MIT","dependencies": {"@react-three/drei": "^10.7.7",@@ -44,7 +44,8 @@"globals": "^17.4.0","typescript": "~5.9.3","typescript-eslint": "^8.57.0",- "vite": "^8.0.1"+ "vite": "^8.0.1",+ "vitest": "^4.1.2"},"engines": {"node": ">=22"@@ -1218,6 +1219,13 @@"dev": true,"license": "MIT"},+ "node_modules/@standard-schema/spec": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@tailwindcss/node": {"version": "4.2.2","resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.2.2.tgz",@@ -1719,6 +1727,17 @@"tslib": "^2.4.0"}},+ "node_modules/@types/chai": {+ "version": "5.2.3",+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",+ "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/deep-eql": "*",+ "assertion-error": "^2.0.1"+ }+ },"node_modules/@types/debug": {"version": "4.1.13","resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz",@@ -1728,6 +1747,13 @@"@types/ms": "*"}},+ "node_modules/@types/deep-eql": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",+ "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@types/draco3d": {"version": "1.4.10","resolved": "https://registry.npmjs.org/@types/draco3d/-/draco3d-1.4.10.tgz",@@ -2223,6 +2249,119 @@}}},+ "node_modules/@vitest/expect": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.2.tgz",+ "integrity": "sha512-gbu+7B0YgUJ2nkdsRJrFFW6X7NTP44WlhiclHniUhxADQJH5Szt9mZ9hWnJPJ8YwOK5zUOSSlSvyzRf0u1DSBQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@standard-schema/spec": "^1.1.0",+ "@types/chai": "^5.2.2",+ "@vitest/spy": "4.1.2",+ "@vitest/utils": "4.1.2",+ "chai": "^6.2.2",+ "tinyrainbow": "^3.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/mocker": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.2.tgz",+ "integrity": "sha512-Ize4iQtEALHDttPRCmN+FKqOl2vxTiNUhzobQFFt/BM1lRUTG7zRCLOykG/6Vo4E4hnUdfVLo5/eqKPukcWW7Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/spy": "4.1.2",+ "estree-walker": "^3.0.3",+ "magic-string": "^0.30.21"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ },+ "peerDependencies": {+ "msw": "^2.4.9",+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"+ },+ "peerDependenciesMeta": {+ "msw": {+ "optional": true+ },+ "vite": {+ "optional": true+ }+ }+ },+ "node_modules/@vitest/pretty-format": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.2.tgz",+ "integrity": "sha512-dwQga8aejqeuB+TvXCMzSQemvV9hNEtDDpgUKDzOmNQayl2OG241PSWeJwKRH3CiC+sESrmoFd49rfnq7T4RnA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "tinyrainbow": "^3.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/runner": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.2.tgz",+ "integrity": "sha512-Gr+FQan34CdiYAwpGJmQG8PgkyFVmARK8/xSijia3eTFgVfpcpztWLuP6FttGNfPLJhaZVP/euvujeNYar36OQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/utils": "4.1.2",+ "pathe": "^2.0.3"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/snapshot": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.2.tgz",+ "integrity": "sha512-g7yfUmxYS4mNxk31qbOYsSt2F4m1E02LFqO53Xpzg3zKMhLAPZAjjfyl9e6z7HrW6LvUdTwAQR3HHfLjpko16A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/pretty-format": "4.1.2",+ "@vitest/utils": "4.1.2",+ "magic-string": "^0.30.21",+ "pathe": "^2.0.3"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/spy": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.2.tgz",+ "integrity": "sha512-DU4fBnbVCJGNBwVA6xSToNXrkZNSiw59H8tcuUspVMsBDBST4nfvsPsEHDHGtWRRnqBERBQu7TrTKskmjqTXKA==",+ "dev": true,+ "license": "MIT",+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/utils": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.2.tgz",+ "integrity": "sha512-xw2/TiX82lQHA06cgbqRKFb5lCAy3axQ4H4SoUFhUsg+wztiet+co86IAMDtF6Vm1hc7J6j09oh/rgDn+JdKIQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/pretty-format": "4.1.2",+ "convert-source-map": "^2.0.0",+ "tinyrainbow": "^3.1.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },"node_modules/@webgpu/types": {"version": "0.1.69","resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.69.tgz",@@ -2301,6 +2440,16 @@"dev": true,"license": "Python-2.0"},+ "node_modules/assertion-error": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ }+ },"node_modules/bail": {"version": "2.0.2","resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz",@@ -2489,6 +2638,16 @@"url": "https://github.com/sponsors/wooorm"}},+ "node_modules/chai": {+ "version": "6.2.2",+ "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz",+ "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },"node_modules/chalk": {"version": "4.1.2","resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",@@ -2764,6 +2923,13 @@"node": ">=10.13.0"}},+ "node_modules/es-module-lexer": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz",+ "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==",+ "dev": true,+ "license": "MIT"+ },"node_modules/escalade": {"version": "3.2.0","resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",@@ -2971,6 +3137,16 @@"url": "https://opencollective.com/unified"}},+ "node_modules/estree-walker": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0"+ }+ },"node_modules/esutils": {"version": "2.0.3","resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",@@ -2981,6 +3157,16 @@"node": ">=0.10.0"}},+ "node_modules/expect-type": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz",+ "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=12.0.0"+ }+ },"node_modules/extend": {"version": "3.0.2","resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",@@ -4946,6 +5132,17 @@"dev": true,"license": "MIT"},+ "node_modules/obug": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz",+ "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==",+ "dev": true,+ "funding": [+ "https://github.com/sponsors/sxzz",+ "https://opencollective.com/debug"+ ],+ "license": "MIT"+ },"node_modules/option": {"version": "0.2.4","resolved": "https://registry.npmjs.org/option/-/option-0.2.4.tgz",@@ -5074,6 +5271,13 @@"node": ">=8"}},+ "node_modules/pathe": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",+ "dev": true,+ "license": "MIT"+ },"node_modules/pdfjs-dist": {"version": "5.6.205","resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-5.6.205.tgz",@@ -5481,6 +5685,13 @@"node": ">=8"}},+ "node_modules/siginfo": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",+ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==",+ "dev": true,+ "license": "ISC"+ },"node_modules/source-map-js": {"version": "1.2.1","resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",@@ -5506,6 +5717,13 @@"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==","license": "BSD-3-Clause"},+ "node_modules/stackback": {+ "version": "0.0.2",+ "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",+ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==",+ "dev": true,+ "license": "MIT"+ },"node_modules/stats-gl": {"version": "2.4.2","resolved": "https://registry.npmjs.org/stats-gl/-/stats-gl-2.4.2.tgz",@@ -5532,6 +5750,13 @@"integrity": "sha512-hNKz8phvYLPEcRkeG1rsGmV5ChMjKDAWU7/OJJdDErPBNChQXxCo3WZurGpnWc6gZhAzEPFad1aVgyOANH1sMw==","license": "MIT"},+ "node_modules/std-env": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.0.0.tgz",+ "integrity": "sha512-zUMPtQ/HBY3/50VbpkupYHbRroTRZJPRLvreamgErJVys0ceuzMkD44J/QjqhHjOzK42GQ3QZIeFG1OYfOtKqQ==",+ "dev": true,+ "license": "MIT"+ },"node_modules/string_decoder": {"version": "1.1.1","resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",@@ -5665,6 +5890,23 @@"integrity": "sha512-IQrh3lEPM93wVCEczc9SaAOvkmcoQn/G8Bo1e8ZPlY3X3bnAxWaBdvTdvM1hP62iZp0BXWDy4vTAy4fF0+Dlpg==","license": "MIT"},+ "node_modules/tinybench": {+ "version": "2.9.0",+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",+ "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/tinyexec": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.4.tgz",+ "integrity": "sha512-u9r3uZC0bdpGOXtlxUIdwf9pkmvhqJdrVCH9fapQtgy/OeTTMZ1nqH7agtvEfmGui6e1XxjcdrlxvxJvc3sMqw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },"node_modules/tinyglobby": {"version": "0.2.15","resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",@@ -5681,6 +5923,16 @@"url": "https://github.com/sponsors/SuperchupuDev"}},+ "node_modules/tinyrainbow": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.0.tgz",+ "integrity": "sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=14.0.0"+ }+ },"node_modules/trim-lines": {"version": "3.0.1","resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",@@ -6121,6 +6373,88 @@}}},+ "node_modules/vitest": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.2.tgz",+ "integrity": "sha512-xjR1dMTVHlFLh98JE3i/f/WePqJsah4A0FK9cc8Ehp9Udk0AZk6ccpIZhh1qJ/yxVWRZ+Q54ocnD8TXmkhspGg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/expect": "4.1.2",+ "@vitest/mocker": "4.1.2",+ "@vitest/pretty-format": "4.1.2",+ "@vitest/runner": "4.1.2",+ "@vitest/snapshot": "4.1.2",+ "@vitest/spy": "4.1.2",+ "@vitest/utils": "4.1.2",+ "es-module-lexer": "^2.0.0",+ "expect-type": "^1.3.0",+ "magic-string": "^0.30.21",+ "obug": "^2.1.1",+ "pathe": "^2.0.3",+ "picomatch": "^4.0.3",+ "std-env": "^4.0.0-rc.1",+ "tinybench": "^2.9.0",+ "tinyexec": "^1.0.2",+ "tinyglobby": "^0.2.15",+ "tinyrainbow": "^3.1.0",+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0",+ "why-is-node-running": "^2.3.0"+ },+ "bin": {+ "vitest": "vitest.mjs"+ },+ "engines": {+ "node": "^20.0.0 || ^22.0.0 || >=24.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ },+ "peerDependencies": {+ "@edge-runtime/vm": "*",+ "@opentelemetry/api": "^1.9.0",+ "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",+ "@vitest/browser-playwright": "4.1.2",+ "@vitest/browser-preview": "4.1.2",+ "@vitest/browser-webdriverio": "4.1.2",+ "@vitest/ui": "4.1.2",+ "happy-dom": "*",+ "jsdom": "*",+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"+ },+ "peerDependenciesMeta": {+ "@edge-runtime/vm": {+ "optional": true+ },+ "@opentelemetry/api": {+ "optional": true+ },+ "@types/node": {+ "optional": true+ },+ "@vitest/browser-playwright": {+ "optional": true+ },+ "@vitest/browser-preview": {+ "optional": true+ },+ "@vitest/browser-webdriverio": {+ "optional": true+ },+ "@vitest/ui": {+ "optional": true+ },+ "happy-dom": {+ "optional": true+ },+ "jsdom": {+ "optional": true+ },+ "vite": {+ "optional": false+ }+ }+ },"node_modules/webgl-constants": {"version": "1.1.1","resolved": "https://registry.npmjs.org/webgl-constants/-/webgl-constants-1.1.1.tgz",@@ -6147,6 +6481,23 @@"node": ">= 8"}},+ "node_modules/why-is-node-running": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",+ "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "siginfo": "^2.0.0",+ "stackback": "0.0.2"+ },+ "bin": {+ "why-is-node-running": "cli.js"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/word-wrap": {"version": "1.2.5","resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",diff --git a/package.json b/package.jsonindex b9ac3121..9f07d5c0 100644--- a/package.json+++ b/package.json@@ -69,6 +69,7 @@"globals": "^17.4.0","typescript": "~5.9.3","typescript-eslint": "^8.57.0",- "vite": "^8.0.1"+ "vite": "^8.0.1",+ "vitest": "^4.1.2"}}diff --git a/src/api/__tests__/model-pipeline.test.ts b/src/api/__tests__/model-pipeline.test.tsnew file mode 100644index 00000000..85e6983a--- /dev/null+++ b/src/api/__tests__/model-pipeline.test.ts@@ -0,0 +1,192 @@+/**+ * Model Pipeline Tests+ *+ * Ensures every model type gets the correct encoder, VAE, defaults, and workflow.+ * Run: npx vitest run src/api/__tests__/model-pipeline.test.ts+ */+import { describe, it, expect } from 'vitest'+import { classifyModel, type ModelType } from '../comfyui'+import { MODEL_TYPE_DEFAULTS } from '../../stores/createStore'+import { COMPONENT_REGISTRY } from '../discover'++// ─── Model Classification ───++describe('classifyModel', () => {+ const cases: [string, ModelType][] = [+ // FLUX 2 — must be detected BEFORE generic flux+ ['flux-2-klein-base-4b-fp8.safetensors', 'flux2'],+ ['flux2-dev-fp8.safetensors', 'flux2'],+ ['FLUX-2-schnell.safetensors', 'flux2'],++ // FLUX 1+ ['flux1-schnell-fp8.safetensors', 'flux'],+ ['flux1-dev-fp8.safetensors', 'flux'],+ ['FLUX.1-schnell.safetensors', 'flux'],++ // SDXL+ ['Juggernaut-XL_v9.safetensors', 'sdxl'],+ ['RealVisXL_V5.safetensors', 'sdxl'],+ ['animagineXL_v3.safetensors', 'sdxl'],+ ['ponyDiffusionV6XL.safetensors', 'sdxl'],+ ['illustriousXL_v01.safetensors', 'sdxl'],+ ['noobaiXL.safetensors', 'sdxl'],+ ['sd_xl_base_1.0.safetensors', 'sdxl'],+ ['zavychromaXL_v10.safetensors', 'sdxl'],++ // SD 1.5+ ['v1-5-pruned.safetensors', 'sd15'],+ ['realisticVisionV51.safetensors', 'sd15'],+ ['deliberate_v3.safetensors', 'sd15'],+ ['dreamshaper_8.safetensors', 'sd15'],+ ['absolutereality_v16.safetensors', 'sd15'],+ ['sd_1.5_base.safetensors', 'sd15'],++ // Wan Video+ ['wan2.1_t2v_1.3B_bf16.safetensors', 'wan'],+ ['wan2.1_t2v_14B_fp8.safetensors', 'wan'],++ // HunyuanVideo+ ['hunyuanvideo1.5_480p_t2v_fp8.safetensors', 'hunyuan'],+ ['hunyuanvideo_t2v.safetensors', 'hunyuan'],+ ]++ for (const [filename, expected] of cases) {+ it(`${filename} → ${expected}`, () => {+ expect(classifyModel(filename)).toBe(expected)+ })+ }++ it('unknown model returns unknown', () => {+ expect(classifyModel('some_random_model.safetensors')).toBe('unknown')+ })++ it('flux2 is detected before flux', () => {+ // This is critical — flux2 patterns must be checked FIRST+ expect(classifyModel('flux-2-dev.safetensors')).toBe('flux2')+ expect(classifyModel('flux2-schnell.safetensors')).toBe('flux2')+ // Generic flux should NOT match flux2+ expect(classifyModel('flux1-dev.safetensors')).toBe('flux')+ })++ it('wan is detected before other patterns', () => {+ expect(classifyModel('wan2.1_model.safetensors')).toBe('wan')+ })+})++// ─── Model Type Defaults ───++describe('MODEL_TYPE_DEFAULTS', () => {+ it('every ModelType has defaults', () => {+ const allTypes: ModelType[] = ['sd15', 'sdxl', 'flux', 'flux2', 'wan', 'hunyuan', 'unknown']+ for (const type of allTypes) {+ const defaults = MODEL_TYPE_DEFAULTS[type]+ expect(defaults, `missing defaults for ${type}`).toBeDefined()+ expect(defaults.steps).toBeGreaterThan(0)+ expect(defaults.cfgScale).toBeGreaterThanOrEqual(0)+ expect(defaults.width).toBeGreaterThan(0)+ expect(defaults.height).toBeGreaterThan(0)+ expect(defaults.sampler).toBeTruthy()+ expect(defaults.scheduler).toBeTruthy()+ }+ })++ it('FLUX uses low CFG (1.0)', () => {+ expect(MODEL_TYPE_DEFAULTS.flux.cfgScale).toBe(1.0)+ expect(MODEL_TYPE_DEFAULTS.flux2.cfgScale).toBe(1.0)+ })++ it('SD1.5 uses 512x512', () => {+ expect(MODEL_TYPE_DEFAULTS.sd15.width).toBe(512)+ expect(MODEL_TYPE_DEFAULTS.sd15.height).toBe(512)+ })++ it('SDXL/FLUX uses 1024x1024', () => {+ expect(MODEL_TYPE_DEFAULTS.sdxl.width).toBe(1024)+ expect(MODEL_TYPE_DEFAULTS.flux.width).toBe(1024)+ })++ it('Video models have frames and fps', () => {+ expect(MODEL_TYPE_DEFAULTS.wan.frames).toBeGreaterThan(0)+ expect(MODEL_TYPE_DEFAULTS.wan.fps).toBeGreaterThan(0)+ expect(MODEL_TYPE_DEFAULTS.hunyuan.frames).toBeGreaterThan(0)+ expect(MODEL_TYPE_DEFAULTS.hunyuan.fps).toBeGreaterThan(0)+ })+})++// ─── COMPONENT_REGISTRY Consistency ───++describe('COMPONENT_REGISTRY', () => {+ it('checkpoint models (sd15, sdxl) dont need separate VAE/CLIP', () => {+ expect(COMPONENT_REGISTRY.sd15.needsSeparateVAE).toBe(false)+ expect(COMPONENT_REGISTRY.sd15.needsSeparateCLIP).toBe(false)+ expect(COMPONENT_REGISTRY.sdxl.needsSeparateVAE).toBe(false)+ expect(COMPONENT_REGISTRY.sdxl.needsSeparateCLIP).toBe(false)+ })++ it('UNET models (flux, flux2, wan, hunyuan) need separate VAE/CLIP', () => {+ for (const type of ['flux', 'flux2', 'wan', 'hunyuan'] as ModelType[]) {+ const reg = COMPONENT_REGISTRY[type]+ expect(reg.needsSeparateVAE, `${type} needs VAE`).toBe(true)+ expect(reg.needsSeparateCLIP, `${type} needs CLIP`).toBe(true)+ expect(reg.vae, `${type} has VAE spec`).toBeDefined()+ expect(reg.clip, `${type} has CLIP spec`).toBeDefined()+ expect(reg.vae!.downloadUrl, `${type} VAE has URL`).toContain('https://')+ expect(reg.clip!.downloadUrl, `${type} CLIP has URL`).toContain('https://')+ }+ })++ it('FLUX 1 uses T5 encoder', () => {+ expect(COMPONENT_REGISTRY.flux.clip!.patterns).toContain('t5xxl')+ })++ it('FLUX 2 uses Qwen/Mistral encoder (NOT T5)', () => {+ const patterns = COMPONENT_REGISTRY.flux2.clip!.patterns+ expect(patterns).toContain('qwen')+ expect(patterns).not.toContain('t5xxl')+ })++ it('Wan uses UMT5 encoder', () => {+ expect(COMPONENT_REGISTRY.wan.clip!.patterns).toContain('umt5')+ })++ it('Hunyuan uses Qwen encoder', () => {+ expect(COMPONENT_REGISTRY.hunyuan.clip!.patterns).toContain('qwen')+ })++ it('every downloadUrl is HTTPS', () => {+ for (const [type, reg] of Object.entries(COMPONENT_REGISTRY)) {+ if (reg.vae?.downloadUrl) {+ expect(reg.vae.downloadUrl, `${type} VAE URL`).toMatch(/^https:\/\//)+ }+ if (reg.clip?.downloadUrl) {+ expect(reg.clip.downloadUrl, `${type} CLIP URL`).toMatch(/^https:\/\//)+ }+ }+ })+})++// ─── Encoder-Type Consistency ───+// This is the most critical test: the CLIP file patterns in findMatchingCLIP()+// must be compatible with the CLIPLoader type in dynamic-workflow.ts++describe('Encoder-Type consistency', () => {+ // Map of model type → expected CLIPLoader type → compatible encoder patterns+ const EXPECTED_CLIP_TYPES: Record<string, { loaderType: string; encoderPatterns: string[] }> = {+ flux: { loaderType: 'flux', encoderPatterns: ['t5', 'clip_l'] },+ flux2: { loaderType: 'flux2', encoderPatterns: ['qwen', 'mistral'] },+ wan: { loaderType: 'wan', encoderPatterns: ['umt5', 'wan', 't5'] },+ hunyuan: { loaderType: 'wan', encoderPatterns: ['qwen', 'llava', 'umt5'] },+ }++ for (const [type, expected] of Object.entries(EXPECTED_CLIP_TYPES)) {+ it(`${type}: registry patterns match expected encoder type`, () => {+ const reg = COMPONENT_REGISTRY[type as ModelType]+ if (!reg.clip) return+ // At least one pattern should be in the expected list+ const hasMatch = reg.clip.patterns.some(p =>+ expected.encoderPatterns.some(e => p.includes(e) || e.includes(p))+ )+ expect(hasMatch, `${type}: registry patterns ${reg.clip.patterns} should overlap with ${expected.encoderPatterns}`).toBe(true)+ })+ }+})diff --git a/src/api/discover.ts b/src/api/discover.tsindex 2cea786a..77ccf7a7 100644--- a/src/api/discover.ts+++ b/src/api/discover.ts@@ -90,9 +90,8 @@ export const COMPONENT_REGISTRY: Record<ModelType, ComponentRequirements> = {},flux2: {loader: 'UNETLoader',- vae: { patterns: ['ae', 'flux'], downloadName: 'flux2-vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-4b/resolve/main/split_files/vae/flux2-vae.safetensors', subfolder: 'vae' },- clip: { patterns: ['t5xxl', 't5-xxl', 't5_xxl'], downloadName: 't5xxl_fp8_e4m3fn.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors', subfolder: 'text_encoders' },- clipSecondary: { patterns: ['clip_l'], downloadName: 'clip_l.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors', subfolder: 'text_encoders' },+ vae: { patterns: ['flux2', 'flux'], downloadName: 'flux2-vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-4b/resolve/main/split_files/vae/flux2-vae.safetensors', subfolder: 'vae' },+ clip: { patterns: ['qwen', 'mistral'], downloadName: 'qwen_3_4b_fp4_flux2.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-4b/resolve/main/split_files/text_encoders/qwen_3_4b_fp4_flux2.safetensors', subfolder: 'text_encoders' },needsSeparateVAE: true,needsSeparateCLIP: true,},