From d6f23a6376d5cbda735f9c19eb8e8afeb6cd2d7b Mon Sep 17 00:00:00 2001
From: nodemode-ai
Date: Mon, 30 Nov 2026 16:24:04 -0500
Subject: [PATCH 1/6] feat(models): a person can choose the folder models are
kept in, from the next start
The installed app kept every model in the data folder, on the system drive on
Windows (issue 43). The engine now takes the models folder from
FORMCUT_MODELS_DIR, else from models-folder.json in the data folder, else the
default; a chosen folder that cannot be reached at start falls back to the
default for that run. With a chosen folder the Pocket TTS and Chatterbox
downloads and a new speech runtime go there too; an existing runtime in the
data folder keeps working.
GET /api/storage reports the folder, where it comes from and what applies after
a restart. PUT /api/storage/models-folder checks the path is absolute, outside
the data folder and writable, and nests formcut-models in a folder that already
holds other files. POST /api/storage/models-folder/copy copies what is already
downloaded as a job, file by file through .part names, and removes nothing.
Seen: driven against a scratch data folder across two engine starts. Not run:
Windows, a real second drive.
---
backend/HASHOUT_LOG.md | 11 +++
backend/app/local_speech.py | 16 +++--
backend/app/paths.py | 41 +++++++++--
backend/app/storage.py | 137 +++++++++++++++++++++++++++++++++++-
backend/setup_local_ai.py | 4 +-
5 files changed, 195 insertions(+), 14 deletions(-)
diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md
index 372f6414..8864334b 100644
--- a/backend/HASHOUT_LOG.md
+++ b/backend/HASHOUT_LOG.md
@@ -2,6 +2,17 @@
Reasoning behind engine changes, newest first.
+## Unreleased · a person can choose the folder models are kept in (`app/paths.py`, `app/storage.py`, `app/local_speech.py`, `setup_local_ai.py`)
+
+- **Why.** Issue 43: on Windows the installed app keeps every model in `%LOCALAPPDATA%\formcut\models`, on the system drive, and the largest catalogue entry alone is 22.19 GB. `FORMCUT_MODELS_DIR` could move them, but only from the environment, which an installed app gives a person no way to set.
+- **`paths.py`.** `models_place()` returns the folder and where it came from: `environment` (`FORMCUT_MODELS_DIR`, as before, and it wins), `chosen` (the absolute path in `models-folder.json` in the data folder, read by `chosen_models_folder()`), `default` (`default_models_root()`, the earlier body of `models_root()`), or `unreachable` when the chosen folder cannot be made at start, in which case the default folder is used for that run so the engine still starts. `MODELS_DIR` and `MODELS_SOURCE` come from it. `models_root()` stays and returns the folder. Replaced, quoted exactly: `MODELS_DIR = models_root()`.
+- **Applies at the next start.** `MODELS_DIR` is a constant that `model_manager`, `klein`, `krea2`, `local_diffusion`, `checkpoints`, `ai_upscale` and the function isolation import, so a change made while the engine runs is written to the file and taken up when it starts again. Making it live would mean every one of those reading the folder on each use.
+- **The voices follow only a chosen folder.** `VOICE_CACHE_DIR` and `SPEECH_RUNTIME_DIR` are the models folder (and `ai-runtime` inside it) when the source is `chosen`, and the data folder's `models` and `ai-runtime` otherwise, so nobody who runs from source or sets the variable has a download or a runtime move under them. `_worker_env` hands them to the Pocket TTS and Chatterbox workers as `HF_HOME` and `TORCH_HOME`. Replaced, quoted exactly: ` cache = DATA_DIR / "models" / "huggingface"` and ` return {**env, "HF_HOME": str(cache), "TORCH_HOME": str(DATA_DIR / "models" / "torch")}`.
+- **The speech runtime is not moved.** A virtual environment holds absolute paths, so `_venv_python()` uses the runtime in the chosen folder when there is one and otherwise the earlier one in the data folder, which keeps working. `setup_local_ai.py` makes a new one in `SPEECH_RUNTIME_DIR`. Replaced twice in `local_speech.py`, quoted exactly: ` venv = DATA_DIR / "ai-runtime" / ("Scripts/python.exe" if sys.platform == "win32" else "bin/python")`; and in `setup_local_ai.py`: ` root = DATA_DIR / "ai-runtime"`.
+- **`storage.py`.** `GET /api/storage` gains `models` (`folder` in use, `source`, `default`, `next` for the folder after a restart, `restart`, `free` on that folder's drive, `copyable`) and an area `models folder` when the folder in use is outside the data folder. `PUT /api/storage/models-folder` settles the path in `_settle`: it must be absolute, not a file, outside the data folder and writable (a file is made and removed); a folder that already holds files and whose name does not begin with `formcut` gets `formcut-models` inside it, so a person who picks `D:\` does not get model files among their own. The choice is written beside itself and renamed into place; `{"folder": null}` removes it. With the variable set the route answers 409.
+- **Copy, never move.** `POST /api/storage/models-folder/copy` is a `models-copy` job: everything under the folder in use except `ai-runtime`, and the two voice folders when they are elsewhere, into the folder for the next start. Each file is written as `.part` and renamed, a file already there at the same size is kept, links are made again as links (the Hugging Face folder is built from them), and the job stops before it begins when the drive has too little room. Nothing is removed, because the running engine still reads the old folder until it restarts. After the restart `model_manager.adopt_legacy` finds its files already in place and moves nothing.
+- **Seen.** Driven against a scratch data folder across two engine starts: the three refusals, the nested `formcut-models`, the copy and a second copy that keeps every file, the folder in use after the restart, the voice folders following it, the default again, and the 409 with the variable set. Not run: Windows, a real second drive, a drive unplugged at start, a copy of tens of gigabytes.
+
## Unreleased · THIRD-PARTY-NOTICES.txt holds the full licence text of everything that ships (`setup/notices.py`, `app/notices_api.py`)
- **What was missing.** NOTICE and `.docs/wiki/Licences.md` named the components and their licences, but only some of the licence texts travelled with the app (the FFmpeg sidecar's, OpenCV's, a few in copied package metadata). MIT, BSD and Apache terms ask for the text with the binaries.
diff --git a/backend/app/local_speech.py b/backend/app/local_speech.py
index 4ca48fda..6a860671 100644
--- a/backend/app/local_speech.py
+++ b/backend/app/local_speech.py
@@ -10,7 +10,7 @@
from . import jobs
from .media import ingest_path
from .model_manager import ROOT, ready
-from .paths import DATA_DIR
+from .paths import DATA_DIR, SPEECH_RUNTIME_DIR, VOICE_CACHE_DIR
from .processes import communicate
router = APIRouter(prefix="/api/speech", tags=["speech"])
@@ -146,6 +146,12 @@ def synthesise_in_engine(args: dict) -> None:
_kokoro_models: dict = {}
+def _venv_python() -> Path:
+ name = "Scripts/python.exe" if sys.platform == "win32" else "bin/python"
+ chosen, earlier = SPEECH_RUNTIME_DIR / name, DATA_DIR / "ai-runtime" / name
+ return earlier if earlier.is_file() and not chosen.is_file() else chosen
+
+
def interpreter():
# The shipped voice runs in the engine itself when it can; the override
# and the data/ai-runtime venv are for the two PyTorch voices, which are
@@ -153,7 +159,7 @@ def interpreter():
if kokoro_in_engine() and not os.environ.get("FORMCUT_AI_PYTHON"):
return ENGINE_RUNTIME
override = os.environ.get("FORMCUT_AI_PYTHON")
- venv = DATA_DIR / "ai-runtime" / ("Scripts/python.exe" if sys.platform == "win32" else "bin/python")
+ venv = _venv_python()
candidate = override or (str(venv) if venv.is_file() else (sys.executable if not getattr(sys, "frozen", False) else None))
if not candidate:
return None
@@ -169,7 +175,7 @@ def interpreter():
def runtime() -> str | None:
"""The speech runtime's Python, whatever it has installed: the override, or data/ai-runtime."""
override = os.environ.get("FORMCUT_AI_PYTHON")
- venv = DATA_DIR / "ai-runtime" / ("Scripts/python.exe" if sys.platform == "win32" else "bin/python")
+ venv = _venv_python()
return override or (str(venv) if venv.is_file() else None)
@@ -202,9 +208,9 @@ def _worker_env() -> dict:
env[name] = os.pathsep.join(kept)
else:
env.pop(name, None)
- cache = DATA_DIR / "models" / "huggingface"
+ cache = VOICE_CACHE_DIR / "huggingface"
cache.mkdir(parents=True, exist_ok=True)
- return {**env, "HF_HOME": str(cache), "TORCH_HOME": str(DATA_DIR / "models" / "torch")}
+ return {**env, "HF_HOME": str(cache), "TORCH_HOME": str(VOICE_CACHE_DIR / "torch")}
def pocket_voices() -> list[str]:
diff --git a/backend/app/paths.py b/backend/app/paths.py
index 24ffe013..ebab7988 100644
--- a/backend/app/paths.py
+++ b/backend/app/paths.py
@@ -1,3 +1,4 @@
+import json
import os
import sys
from pathlib import Path
@@ -20,13 +21,43 @@ def data_root() -> Path:
DATA_DIR = data_root()
-def models_root() -> Path:
- configured = os.environ.get("FORMCUT_MODELS_DIR")
- if configured:
- return Path(configured).expanduser().resolve()
+MODELS_CHOICE = DATA_DIR / "models-folder.json"
+
+
+def default_models_root() -> Path:
if getattr(sys, "frozen", False):
return DATA_DIR / "models"
return Path(__file__).resolve().parents[2] / "models"
-MODELS_DIR = models_root()
+def chosen_models_folder() -> Path | None:
+ try:
+ folder = json.loads(MODELS_CHOICE.read_text(encoding="utf-8"))["folder"]
+ except (OSError, ValueError, KeyError, TypeError):
+ return None
+ if not isinstance(folder, str) or not Path(folder).is_absolute():
+ return None
+ return Path(folder)
+
+
+def models_place() -> tuple[Path, str]:
+ configured = os.environ.get("FORMCUT_MODELS_DIR")
+ if configured:
+ return Path(configured).expanduser().resolve(), "environment"
+ chosen = chosen_models_folder()
+ if chosen is None:
+ return default_models_root(), "default"
+ try:
+ chosen.mkdir(parents=True, exist_ok=True)
+ except OSError:
+ return default_models_root(), "unreachable"
+ return chosen, "chosen"
+
+
+def models_root() -> Path:
+ return models_place()[0]
+
+
+MODELS_DIR, MODELS_SOURCE = models_place()
+VOICE_CACHE_DIR = MODELS_DIR if MODELS_SOURCE == "chosen" else DATA_DIR / "models"
+SPEECH_RUNTIME_DIR = MODELS_DIR / "ai-runtime" if MODELS_SOURCE == "chosen" else DATA_DIR / "ai-runtime"
diff --git a/backend/app/storage.py b/backend/app/storage.py
index 24f2d94a..d4c623ef 100644
--- a/backend/app/storage.py
+++ b/backend/app/storage.py
@@ -7,12 +7,16 @@
"""
import contextlib
+import json
+import os
import shutil
from pathlib import Path
-from fastapi import APIRouter
+from fastapi import APIRouter, HTTPException
+from pydantic import BaseModel
-from .paths import DATA_DIR
+from . import jobs
+from .paths import DATA_DIR, MODELS_CHOICE, MODELS_DIR, MODELS_SOURCE, VOICE_CACHE_DIR, chosen_models_folder, default_models_root
router = APIRouter(prefix="/api/storage", tags=["storage"])
@@ -54,6 +58,10 @@ def usage() -> dict:
size, count = _size(DATA_DIR / folder)
if size or count:
areas.append({"label": label, "folder": folder, "bytes": size, "files": count, "derived": derived})
+ if MODELS_DIR.resolve() != (DATA_DIR / "models").resolve():
+ size, count = _size(MODELS_DIR)
+ if size or count:
+ areas.append({"label": "models folder", "folder": str(MODELS_DIR), "bytes": size, "files": count, "derived": True})
free = 0
with contextlib.suppress(OSError):
free = shutil.disk_usage(DATA_DIR).free
@@ -63,4 +71,129 @@ def usage() -> dict:
"reclaimable": sum(area["bytes"] for area in areas if area["derived"]),
"free": free,
"areas": sorted(areas, key=lambda area: -area["bytes"]),
+ "models": models_folder(),
+ }
+
+
+def _after_restart() -> Path:
+ if MODELS_SOURCE == "environment":
+ return MODELS_DIR
+ return chosen_models_folder() or default_models_root()
+
+
+def _free(path: Path) -> int:
+ for place in (path, *path.parents):
+ if place.exists():
+ with contextlib.suppress(OSError):
+ return shutil.disk_usage(place).free
+ return 0
+ return 0
+
+
+def _copy_plan(target: Path) -> list[tuple[Path, Path]]:
+ plan: list[tuple[Path, Path]] = []
+ roots = [(MODELS_DIR, target)]
+ if VOICE_CACHE_DIR.resolve() != MODELS_DIR.resolve():
+ roots += [(VOICE_CACHE_DIR / name, target / name) for name in ("huggingface", "torch")]
+ for source, into in roots:
+ if not source.is_dir() or source.resolve() == into.resolve():
+ continue
+ for entry in source.rglob("*"):
+ relative = entry.relative_to(source)
+ if relative.parts[0] == "ai-runtime" or entry.name.endswith(".part"):
+ continue
+ if entry.is_symlink() or entry.is_file():
+ plan.append((entry, into / relative))
+ return plan
+
+
+def models_folder() -> dict:
+ after = _after_restart()
+ restart = after.resolve() != MODELS_DIR.resolve()
+ return {
+ "folder": str(MODELS_DIR),
+ "source": MODELS_SOURCE,
+ "default": str(default_models_root()),
+ "next": str(after),
+ "restart": restart,
+ "free": _free(after),
+ "copyable": restart and bool(_copy_plan(after)),
}
+
+
+class FolderBody(BaseModel):
+ folder: str | None = None
+
+
+def _settle(folder: str) -> Path:
+ path = Path(folder.strip()).expanduser()
+ if not path.is_absolute():
+ raise HTTPException(422, "Give the full path of a folder on this computer")
+ path = path.resolve()
+ if path.is_file():
+ raise HTTPException(422, "That is a file. Choose a folder")
+ data = DATA_DIR.resolve()
+ if path == data or data in path.parents:
+ raise HTTPException(422, "Choose a folder outside formcut's data folder, or use the default folder")
+ try:
+ if path.is_dir() and any(path.iterdir()) and not path.name.lower().startswith("formcut"):
+ path = path / "formcut-models"
+ path.mkdir(parents=True, exist_ok=True)
+ probe = path / ".formcut-write-check"
+ probe.write_bytes(b"")
+ probe.unlink()
+ except OSError as exc:
+ raise HTTPException(422, f"formcut cannot write to {path}") from exc
+ return path
+
+
+@router.put("/models-folder")
+def set_models_folder(body: FolderBody) -> dict:
+ """Where models are kept from the next start on: a folder the person chose, or the default again with none."""
+ if MODELS_SOURCE == "environment":
+ raise HTTPException(409, "The models folder is set by FORMCUT_MODELS_DIR. Remove that setting to choose a folder here")
+ if body.folder is None or not body.folder.strip():
+ MODELS_CHOICE.unlink(missing_ok=True)
+ return models_folder()
+ path = _settle(body.folder)
+ DATA_DIR.mkdir(parents=True, exist_ok=True)
+ draft = MODELS_CHOICE.with_name(MODELS_CHOICE.name + ".part")
+ draft.write_text(json.dumps({"folder": str(path)}), encoding="utf-8")
+ os.replace(draft, MODELS_CHOICE)
+ return models_folder()
+
+
+def _copy(target: Path, report, cancelled) -> dict:
+ plan = _copy_plan(target)
+ waiting = [
+ (source, into) for source, into in plan if source.is_symlink() or not into.is_file() or into.stat().st_size != source.stat().st_size
+ ]
+ total = sum(source.stat().st_size for source, _into in waiting if not source.is_symlink())
+ if total > _free(target):
+ raise ValueError(f"{target} has too little free space for the models already downloaded")
+ done = 0
+ copied = 0
+ for source, into in waiting:
+ if cancelled():
+ raise InterruptedError("Cancelled")
+ into.parent.mkdir(parents=True, exist_ok=True)
+ if source.is_symlink():
+ if not into.is_symlink() and not into.exists():
+ os.symlink(os.readlink(source), into)
+ continue
+ draft = into.with_name(into.name + ".part")
+ shutil.copy2(source, draft)
+ os.replace(draft, into)
+ copied += 1
+ done += source.stat().st_size
+ report(done / total if total else 1.0)
+ return {"folder": str(target), "copied": copied, "kept": len(plan) - len(waiting), "bytes": done}
+
+
+@router.post("/models-folder/copy", status_code=202)
+def copy_models() -> dict:
+ """Copy the models already downloaded into the folder used after the next start. Nothing is removed from the folder in use."""
+ target = _after_restart()
+ if target.resolve() == MODELS_DIR.resolve():
+ raise HTTPException(409, "The models are already in the folder formcut uses")
+ return jobs.submit("models-copy", lambda _id, report, cancelled: _copy(target, report, cancelled))
diff --git a/backend/setup_local_ai.py b/backend/setup_local_ai.py
index 4c49cdd7..e9e836dc 100644
--- a/backend/setup_local_ai.py
+++ b/backend/setup_local_ai.py
@@ -12,9 +12,9 @@ def main():
key, sep, value = line.strip().partition("=")
if sep and key.strip() == "FORMCUT_DATA_DIR":
os.environ["FORMCUT_DATA_DIR"] = value.strip().strip("\"'")
- from app.paths import DATA_DIR
+ from app.paths import SPEECH_RUNTIME_DIR
- root = DATA_DIR / "ai-runtime"
+ root = SPEECH_RUNTIME_DIR
python = root / ("Scripts/python.exe" if sys.platform == "win32" else "bin/python")
if python.is_file():
probe = subprocess.run([str(python), "-c", "import kokoro_onnx"], capture_output=True, text=True)
From d186d4fb02c2a9587d0abf215b050023986463d1 Mon Sep 17 00:00:00 2001
From: nodemode-ai
Date: Mon, 30 Nov 2026 16:24:04 -0500
Subject: [PATCH 2/6] feat(storage): Choose models folder, Use the default
folder and Copy downloaded models
The home screen's Storage view shows the models folder and the free space on its
drive, and says when a change applies after a restart or when
FORMCUT_MODELS_DIR fixes it. Three chips choose a folder with the system dialog,
go back to the default, and copy the downloaded models with progress. The line
and the chips are made once and patched in place. Strings in English, German
and Spanish.
Seen: tsc --noEmit, npm run build, and the view in headless Chromium at 4x CPU
and a slow network with no layout shift. Not seen: the Tauri window or Windows'
folder dialog.
---
frontend/HASHOUT_LOG.md | 8 +++++
frontend/src/i18n/de.json | 11 +++++++
frontend/src/i18n/en.json | 11 +++++++
frontend/src/i18n/es.json | 11 +++++++
frontend/src/ui/start-screen.ts | 57 ++++++++++++++++++++++++++++++++-
5 files changed, 97 insertions(+), 1 deletion(-)
diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md
index 436946df..b5bdd1b1 100644
--- a/frontend/HASHOUT_LOG.md
+++ b/frontend/HASHOUT_LOG.md
@@ -2,6 +2,14 @@
Reasoning behind interface changes, newest first.
+## Unreleased · Storage chooses the models folder (`ui/start-screen.ts` renderStorage, modelsLine, the storage branch of show; `i18n/en.json`, `de.json`, `es.json`)
+
+- **What it adds.** The home screen's Storage view gains a line under the usage summary, `Models folder: · free on disk`, with `used after formcut restarts`, `set by FORMCUT_MODELS_DIR` or `cannot be reached, so the default folder is in use` after it when that holds. Three chips in the view's actions row: **Choose models folder** (the engine's own folder dialog through `/api/system/choose` with `kind: "folder"`, then `PUT /api/storage/models-folder`), **Use the default folder** (`{"folder": null}`), and **Copy downloaded models** (`POST /api/storage/models-folder/copy`, followed with `waitJob`, progress in the status line).
+- **No re-render.** `modelsLine` writes one `p.models-line` made once by `child()` and changes its text only when it differs, as `emptyNote` does; the chips are made once per visit to the view and only their `disabled` changes. The chips start disabled until the first answer, so nothing can be pressed against a folder not yet read. Seen in Chromium at 4x CPU and a slow network: no layout shift from opening Storage through Choose, Copy and Default.
+- **While copying** all three chips are off, and a copy finishing after the person left the view does not write into another view's status line.
+- **Strings.** Eleven `home.models*` keys in English, German and Spanish. `home.modelsArea` matches the engine's area label `models folder` for `text()`.
+- **Seen.** `tsc --noEmit`, `npm run build`, and the view in headless Chromium against a scratch engine: the line, the three chips' states before and after a folder is set, a copy that lands the file, and the default again. The system folder dialog cannot open headless, so the folder was sent with the same request the chip sends. Not seen: the Tauri window, Windows' folder dialog, the German and Spanish lines on screen.
+
## 2.21.0 · Blend mode and Timeline height menus take the same cap and hint
- **Why.** The two other menus that open at a point, under a button inside the window (Blend mode in the inspector, the timeline's height chip), had the same uncapped `.dropdown` card; Blend mode, opened low in the inspector of a short window, ran off the bottom. Both now `fitMenu` once and open through `openUnder(menu, box.left, box.bottom + 4)`, so they keep their place under the button, take `menuCap` from that top while hidden, and show the hint. They do not flip above the button. `aria-expanded` follows open and close as before.
diff --git a/frontend/src/i18n/de.json b/frontend/src/i18n/de.json
index b1792988..93ce3175 100644
--- a/frontend/src/i18n/de.json
+++ b/frontend/src/i18n/de.json
@@ -713,6 +713,17 @@
"home.library": "Bibliothek",
"home.items": "Elemente",
"home.derived": "wiederherstellbar",
+ "home.modelsFolder": "Modellordner",
+ "home.modelsArea": "Modellordner",
+ "home.modelsChoose": "Modellordner wählen",
+ "home.modelsDefault": "Standardordner verwenden",
+ "home.modelsCopy": "Geladene Modelle kopieren",
+ "home.modelsRestart": "gilt nach einem Neustart von formcut",
+ "home.modelsEnv": "durch FORMCUT_MODELS_DIR festgelegt",
+ "home.modelsUnreachable": "nicht erreichbar, daher wird der Standardordner verwendet",
+ "home.modelsSaved": "Gespeichert. formcut verwendet den Ordner nach einem Neustart.",
+ "home.modelsCopying": "Modelle werden kopiert",
+ "home.modelsCopied": "Modelle kopiert nach",
"set.connections": "Verbindungen",
"conn.sessions": "Orchestratoren",
"conn.sessions.hint": "Systeme, die diese Engine steuern",
diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json
index c2fa99b9..873a327c 100644
--- a/frontend/src/i18n/en.json
+++ b/frontend/src/i18n/en.json
@@ -713,6 +713,17 @@
"home.library": "Library",
"home.items": "items",
"home.derived": "rebuildable",
+ "home.modelsFolder": "Models folder",
+ "home.modelsArea": "models folder",
+ "home.modelsChoose": "Choose models folder",
+ "home.modelsDefault": "Use the default folder",
+ "home.modelsCopy": "Copy downloaded models",
+ "home.modelsRestart": "used after formcut restarts",
+ "home.modelsEnv": "set by FORMCUT_MODELS_DIR",
+ "home.modelsUnreachable": "cannot be reached, so the default folder is in use",
+ "home.modelsSaved": "Saved. formcut uses the folder after it restarts.",
+ "home.modelsCopying": "Copying models",
+ "home.modelsCopied": "Models copied to",
"set.connections": "Connections",
"conn.sessions": "Orchestrators",
"conn.sessions.hint": "Systems driving this engine",
diff --git a/frontend/src/i18n/es.json b/frontend/src/i18n/es.json
index eac4ef60..dd6b69dd 100644
--- a/frontend/src/i18n/es.json
+++ b/frontend/src/i18n/es.json
@@ -713,6 +713,17 @@
"home.library": "Biblioteca",
"home.items": "elementos",
"home.derived": "reconstruible",
+ "home.modelsFolder": "Carpeta de modelos",
+ "home.modelsArea": "carpeta de modelos",
+ "home.modelsChoose": "Elegir carpeta de modelos",
+ "home.modelsDefault": "Usar la carpeta predeterminada",
+ "home.modelsCopy": "Copiar los modelos descargados",
+ "home.modelsRestart": "se usa al reiniciar formcut",
+ "home.modelsEnv": "definida por FORMCUT_MODELS_DIR",
+ "home.modelsUnreachable": "no se puede acceder, por eso se usa la carpeta predeterminada",
+ "home.modelsSaved": "Guardado. formcut usa la carpeta al reiniciarse.",
+ "home.modelsCopying": "Copiando modelos",
+ "home.modelsCopied": "Modelos copiados en",
"set.connections": "Conexiones",
"conn.sessions": "Orquestadores",
"conn.sessions.hint": "Sistemas que controlan este motor",
diff --git a/frontend/src/ui/start-screen.ts b/frontend/src/ui/start-screen.ts
index f4f3db51..cef6a24c 100644
--- a/frontend/src/ui/start-screen.ts
+++ b/frontend/src/ui/start-screen.ts
@@ -14,7 +14,7 @@ import type { MediaBin } from "../engine/media";
import { loadDemoProject } from "../engine/demo";
import { REPO_DEMOS, openRepoDemo } from "../demos";
import { listProjects, newProject, openProject, listJournals, restoreJournal, clearJournal } from "../engine/persistence";
-import { api } from "../engine/api";
+import { api, waitJob } from "../engine/api";
import { NTSC_RATES, rateLabel } from "../engine/rates";
import { icon } from "./icons";
import { reconcile } from "./keyed-list";
@@ -657,14 +657,30 @@ export function buildStartScreen(engine: ProjectEngine, bin: MediaBin): HTMLElem
emptyNote(host, entries.length ? null : t(emptyKey));
};
+ type ModelsFolder = { folder: string; source: string; default: string; next: string; restart: boolean; free: number; copyable: boolean };
+ const modelChips: { choose?: HTMLButtonElement; reset?: HTMLButtonElement; copy?: HTMLButtonElement } = {};
+ let copyingModels = false;
+ const modelsLine = (host: HTMLElement, models: ModelsFolder) => {
+ const fixed = models.source === "environment";
+ const state = fixed ? t("home.modelsEnv") : models.source === "unreachable" ? t("home.modelsUnreachable") : models.restart ? t("home.modelsRestart") : "";
+ const line = `${t("home.modelsFolder")}: ${models.next} · ${size(models.free)} ${t("home.free")}${state ? ` · ${state}` : ""}`;
+ const node = child(host, "models-line panel-note", "p");
+ if (node.textContent !== line) node.textContent = line;
+ if (modelChips.choose) modelChips.choose.disabled = fixed || copyingModels;
+ if (modelChips.reset) modelChips.reset.disabled = fixed || copyingModels || models.next === models.default;
+ if (modelChips.copy) modelChips.copy.disabled = copyingModels || !models.copyable;
+ };
+
const renderStorage = async () => {
const host = panel("storage");
try {
const usage = await api("/api/storage", undefined, "GET") as {
root: string; total: number; reclaimable: number; free: number;
areas: Array<{ label: string; bytes: number; files: number; derived: boolean }>;
+ models: ModelsFolder;
};
emptyNote(host, `${usage.root} · ${size(usage.total)} ${t("home.used")} · ${size(usage.reclaimable)} ${t("home.reclaimable")} · ${size(usage.free)} ${t("home.free")}`);
+ modelsLine(host, usage.models);
rowsOf(host, usage.areas.map((area) => `${text(area.label)}${area.derived ? ` · ${t("home.derived")}` : ""}${size(area.bytes)} · ${area.files}`));
} catch {
say(t("home.offline"));
@@ -738,6 +754,45 @@ export function buildStartScreen(engine: ProjectEngine, bin: MediaBin): HTMLElem
void renderList("/api/models", (entry) => `${text(String(entry.name ?? entry.id))} · ${entry.ready ? t("home.ready") : t("home.missing")}`, "home.nomodels");
return;
}
+ const failed = (error: unknown) => say(error instanceof Error ? error.message : t("home.failed"));
+ const setModelsFolder = async (folder: string | null) => {
+ try {
+ await api("/api/storage/models-folder", { folder }, "PUT");
+ say(t("home.modelsSaved"));
+ } catch (error) {
+ failed(error);
+ }
+ void renderStorage();
+ };
+ modelChips.choose = chip(t("home.modelsChoose"), () => void (async () => {
+ try {
+ const chosen = await api<{ paths: string[] }>("/api/system/choose", { kind: "folder", title: t("home.modelsChoose") });
+ if (chosen.paths.length) await setModelsFolder(chosen.paths[0]);
+ } catch (error) {
+ failed(error);
+ }
+ })(), "folder");
+ modelChips.reset = chip(t("home.modelsDefault"), () => void setModelsFolder(null), "reset");
+ modelChips.copy = chip(t("home.modelsCopy"), () => void (async () => {
+ copyingModels = true;
+ for (const button of Object.values(modelChips)) button.disabled = true;
+ try {
+ const job = await api<{ job_id: string }>("/api/storage/models-folder/copy", {});
+ const done = await waitJob(job.job_id, (line) => {
+ if (view === "storage") say(`${t("home.modelsCopying")} ${line.split(": ")[1] ?? ""}`);
+ }) as { folder: string };
+ if (view === "storage") say(`${t("home.modelsCopied")} ${done.folder}`);
+ } catch (error) {
+ if (view === "storage") failed(error);
+ }
+ copyingModels = false;
+ if (view === "storage") void renderStorage();
+ })(), "export");
+ for (const button of Object.values(modelChips)) button.disabled = true;
+ modelChips.choose.dataset.act = "models-choose";
+ modelChips.reset.dataset.act = "models-default";
+ modelChips.copy.dataset.act = "models-copy";
+ actions.append(modelChips.choose, modelChips.reset, modelChips.copy);
void renderStorage();
};
From 038275f2e6814403e99031a0c09d9d1967d05749 Mon Sep 17 00:00:00 2001
From: nodemode-ai
Date: Mon, 30 Nov 2026 16:24:04 -0500
Subject: [PATCH 3/6] docs(models): where models are kept, and choosing another
folder from Storage
---
.docs/wiki/Models.md | 32 ++++++++++++++++++++++++++++++++
example.env | 1 +
2 files changed, 33 insertions(+)
diff --git a/.docs/wiki/Models.md b/.docs/wiki/Models.md
index 81fa7568..dbaaf24c 100644
--- a/.docs/wiki/Models.md
+++ b/.docs/wiki/Models.md
@@ -232,6 +232,38 @@ Three things are true of all of them:
reach GitHub or Hugging Face; the pin still applies, so a mirror cannot
substitute a different file.
+## Where models are kept
+
+The installed app keeps models in the `models` folder of its data folder, which
+on Windows is on the system drive. To keep them on another drive, open the home
+screen's **Storage** view and press **Choose models folder**. The line above the
+list shows the folder and the free space on its drive.
+
+- **It applies after a restart.** The engine settles the folder once, when it
+ starts. Until then the line says the folder is used after formcut restarts.
+- **What goes there.** Every model the app downloads, the downloads of the
+ Pocket TTS and Chatterbox voices, and the speech runtime when it is next set
+ up. A speech runtime already made in the data folder keeps working from there;
+ remove the `ai-runtime` folder and run `setup_local_ai` again to move it.
+- **A folder that already holds other files** gets a `formcut-models` folder
+ inside it, so models never mix with your own files.
+- **Copy downloaded models** copies what is already downloaded into the new
+ folder, with progress. Nothing is removed from the folder in use; delete the
+ old `models` folder yourself once formcut has restarted and the models show as
+ installed.
+- **Use the default folder** goes back, also after a restart.
+- **If the folder cannot be reached** at start (a drive that is not plugged
+ in), formcut uses the default folder for that run and says so on the line.
+
+`FORMCUT_MODELS_DIR` still wins when it is set, and the buttons are then off.
+The choice is one small file, `models-folder.json`, in the data folder.
+
+```
+GET /api/storage includes "models": the folder, where it comes from, what applies after a restart
+PUT /api/storage/models-folder {"folder": "D:\\AI"} to choose, {"folder": null} for the default
+POST /api/storage/models-folder/copy copy the downloaded models there, as a job with progress
+```
+
## Local image models on Apple silicon: Krea 2, FLUX.2 [klein] 4B, LoRA stacks
Krea 2 Turbo and FLUX.2 [klein] 4B are optional, installed from their cards in Studio > Local models and run by
diff --git a/example.env b/example.env
index 38d2bee2..b3f7ee64 100644
--- a/example.env
+++ b/example.env
@@ -26,6 +26,7 @@ ELEVENLABS_API_KEY=
# Where AI models live. Defaults to models/ at the repository root when run
# from source, and to the data directory's models folder in the packaged app.
+# The home screen's Storage view can choose a folder too; this setting wins over it.
# FORMCUT_MODELS_DIR=/absolute/path/to/models
# Missing models download in the background when the engine starts. Set to 0
From e05bb90345986a0bc746696f370e113514f99485 Mon Sep 17 00:00:00 2001
From: nodemode-ai
Date: Mon, 30 Nov 2026 16:34:09 -0500
Subject: [PATCH 4/6] i18n: the models folder strings in Arabic, Persian,
Hebrew and Croatian
The four locales that ship as files carry every English string; the eleven home.models strings of the Storage view are added to each. Seen: tests/test_runtime_locales.py.
---
frontend/public/locales/ar.json | 11 +++++++++++
frontend/public/locales/fa.json | 11 +++++++++++
frontend/public/locales/he.json | 11 +++++++++++
frontend/public/locales/hr.json | 11 +++++++++++
4 files changed, 44 insertions(+)
diff --git a/frontend/public/locales/ar.json b/frontend/public/locales/ar.json
index 2225e5f6..8c00ffc4 100644
--- a/frontend/public/locales/ar.json
+++ b/frontend/public/locales/ar.json
@@ -714,6 +714,17 @@
"home.library": "المكتبة",
"home.items": "عناصر",
"home.derived": "قابل لإعادة البناء",
+ "home.modelsFolder": "مجلد النماذج",
+ "home.modelsArea": "مجلد النماذج",
+ "home.modelsChoose": "اختيار مجلد النماذج",
+ "home.modelsDefault": "استخدام المجلد الافتراضي",
+ "home.modelsCopy": "نسخ النماذج المنزّلة",
+ "home.modelsRestart": "يُستخدم بعد إعادة تشغيل formcut",
+ "home.modelsEnv": "محدد بواسطة FORMCUT_MODELS_DIR",
+ "home.modelsUnreachable": "يتعذر الوصول إليه، لذا يُستخدم المجلد الافتراضي",
+ "home.modelsSaved": "تم الحفظ. يستخدم formcut المجلد بعد إعادة تشغيله.",
+ "home.modelsCopying": "جارٍ نسخ النماذج",
+ "home.modelsCopied": "نُسخت النماذج إلى",
"set.connections": "الاتصالات",
"conn.sessions": "المنسّقون",
"conn.sessions.hint": "أنظمة تقود هذا المحرك",
diff --git a/frontend/public/locales/fa.json b/frontend/public/locales/fa.json
index d2bc0fe8..14de91d7 100644
--- a/frontend/public/locales/fa.json
+++ b/frontend/public/locales/fa.json
@@ -714,6 +714,17 @@
"home.library": "کتابخانه",
"home.items": "مورد",
"home.derived": "قابل بازسازی",
+ "home.modelsFolder": "پوشه مدلها",
+ "home.modelsArea": "پوشه مدلها",
+ "home.modelsChoose": "انتخاب پوشه مدلها",
+ "home.modelsDefault": "استفاده از پوشه پیشفرض",
+ "home.modelsCopy": "کپی مدلهای دانلودشده",
+ "home.modelsRestart": "پس از راهاندازی دوباره formcut به کار میرود",
+ "home.modelsEnv": "تعیینشده با FORMCUT_MODELS_DIR",
+ "home.modelsUnreachable": "در دسترس نیست، پس پوشه پیشفرض به کار میرود",
+ "home.modelsSaved": "ذخیره شد. formcut پس از راهاندازی دوباره از این پوشه استفاده میکند.",
+ "home.modelsCopying": "در حال کپی مدلها",
+ "home.modelsCopied": "مدلها کپی شدند به",
"set.connections": "اتصالها",
"conn.sessions": "هماهنگکنندهها",
"conn.sessions.hint": "سامانههایی که این موتور را میگردانند",
diff --git a/frontend/public/locales/he.json b/frontend/public/locales/he.json
index 5a105ff5..4fb2f6a2 100644
--- a/frontend/public/locales/he.json
+++ b/frontend/public/locales/he.json
@@ -714,6 +714,17 @@
"home.library": "ספרייה",
"home.items": "פריטים",
"home.derived": "ניתן לבנייה מחדש",
+ "home.modelsFolder": "תיקיית המודלים",
+ "home.modelsArea": "תיקיית המודלים",
+ "home.modelsChoose": "בחירת תיקיית מודלים",
+ "home.modelsDefault": "שימוש בתיקיית ברירת המחדל",
+ "home.modelsCopy": "העתקת המודלים שהורדו",
+ "home.modelsRestart": "בשימוש לאחר הפעלה מחדש של formcut",
+ "home.modelsEnv": "נקבעה על ידי FORMCUT_MODELS_DIR",
+ "home.modelsUnreachable": "אין גישה אליה, לכן נעשה שימוש בתיקיית ברירת המחדל",
+ "home.modelsSaved": "נשמר. formcut ישתמש בתיקייה לאחר הפעלה מחדש.",
+ "home.modelsCopying": "מעתיק מודלים",
+ "home.modelsCopied": "המודלים הועתקו אל",
"set.connections": "חיבורים",
"conn.sessions": "מתזמרים",
"conn.sessions.hint": "מערכות שמפעילות את המנוע הזה",
diff --git a/frontend/public/locales/hr.json b/frontend/public/locales/hr.json
index 04abdfc4..9f675a79 100644
--- a/frontend/public/locales/hr.json
+++ b/frontend/public/locales/hr.json
@@ -714,6 +714,17 @@
"home.library": "Knjižnica",
"home.items": "stavki",
"home.derived": "moguće ponovno izgraditi",
+ "home.modelsFolder": "Mapa modela",
+ "home.modelsArea": "mapa modela",
+ "home.modelsChoose": "Odaberi mapu modela",
+ "home.modelsDefault": "Koristi zadanu mapu",
+ "home.modelsCopy": "Kopiraj preuzete modele",
+ "home.modelsRestart": "koristi se nakon ponovnog pokretanja formcuta",
+ "home.modelsEnv": "postavljeno s FORMCUT_MODELS_DIR",
+ "home.modelsUnreachable": "nije dostupna, pa se koristi zadana mapa",
+ "home.modelsSaved": "Spremljeno. formcut koristi mapu nakon ponovnog pokretanja.",
+ "home.modelsCopying": "Kopiranje modela",
+ "home.modelsCopied": "Modeli kopirani u",
"set.connections": "Veze",
"conn.sessions": "Orkestratori",
"conn.sessions.hint": "Sustavi koji upravljaju ovim pogonom",
From d1bf4d94289b88cb8d6e13c69178d528c5e26705 Mon Sep 17 00:00:00 2001
From: nodemode-ai
Date: Mon, 30 Nov 2026 16:34:09 -0500
Subject: [PATCH 5/6] docs(skills): the engine map lists storage.py's three
routes
The generated inventory in engine-map.md, as setup/skill_maps.py writes it. Seen: setup/skill_maps.py --check.
---
.../sub-skills/engine-architect/references/engine-map.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.claude/skills/formcut-skillset/sub-skills/engine-architect/references/engine-map.md b/.claude/skills/formcut-skillset/sub-skills/engine-architect/references/engine-map.md
index a6b9a6b7..ddf30016 100644
--- a/.claude/skills/formcut-skillset/sub-skills/engine-architect/references/engine-map.md
+++ b/.claude/skills/formcut-skillset/sub-skills/engine-architect/references/engine-map.md
@@ -70,7 +70,7 @@ The rest is written by hand.
| render_api.py | /api/render | 13 |
| render_stream.py | /api/render | 1 |
| stock.py | /api/stock | 7 |
-| storage.py | /api/storage | 1 |
+| storage.py | /api/storage | 3 |
| subtitles.py | /api/subtitles | 2 |
| templates.py | /api/templates | 7 |
| terminal.py | /api/terminal | 2 |
From 5736bbae2f9c3ce354e6504c7de2b4f9f49593c9 Mon Sep 17 00:00:00 2001
From: nodemode-ai
Date: Mon, 30 Nov 2026 18:08:56 -0500
Subject: [PATCH 6/6] chore(release): 2.21.1, a person can choose the folder
models are kept in, from Storage
---
README.md | 2 +-
backend/HASHOUT_LOG.md | 2 +-
backend/app/main.py | 2 +-
form-functions.json | 2 +-
frontend/HASHOUT_LOG.md | 2 +-
frontend/package-lock.json | 4 ++--
frontend/package.json | 2 +-
src-tauri/Cargo.lock | 2 +-
src-tauri/Cargo.toml | 2 +-
src-tauri/tauri.conf.json | 2 +-
10 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index ce6d4da7..b1547071 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
-
+
diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md
index 8864334b..e277173e 100644
--- a/backend/HASHOUT_LOG.md
+++ b/backend/HASHOUT_LOG.md
@@ -2,7 +2,7 @@
Reasoning behind engine changes, newest first.
-## Unreleased · a person can choose the folder models are kept in (`app/paths.py`, `app/storage.py`, `app/local_speech.py`, `setup_local_ai.py`)
+## 2.21.1 · a person can choose the folder models are kept in (`app/paths.py`, `app/storage.py`, `app/local_speech.py`, `setup_local_ai.py`)
- **Why.** Issue 43: on Windows the installed app keeps every model in `%LOCALAPPDATA%\formcut\models`, on the system drive, and the largest catalogue entry alone is 22.19 GB. `FORMCUT_MODELS_DIR` could move them, but only from the environment, which an installed app gives a person no way to set.
- **`paths.py`.** `models_place()` returns the folder and where it came from: `environment` (`FORMCUT_MODELS_DIR`, as before, and it wins), `chosen` (the absolute path in `models-folder.json` in the data folder, read by `chosen_models_folder()`), `default` (`default_models_root()`, the earlier body of `models_root()`), or `unreachable` when the chosen folder cannot be made at start, in which case the default folder is used for that run so the engine still starts. `MODELS_DIR` and `MODELS_SOURCE` come from it. `models_root()` stays and returns the folder. Replaced, quoted exactly: `MODELS_DIR = models_root()`.
diff --git a/backend/app/main.py b/backend/app/main.py
index d3ab7c43..65d7a474 100644
--- a/backend/app/main.py
+++ b/backend/app/main.py
@@ -37,7 +37,7 @@
prefer_bundled()
-APP_VERSION = "2.21.0"
+APP_VERSION = "2.21.1"
app = FastAPI(title="formcut engine", version=APP_VERSION)
diff --git a/form-functions.json b/form-functions.json
index 55cbb71a..d12a3085 100644
--- a/form-functions.json
+++ b/form-functions.json
@@ -2,7 +2,7 @@
"format": "form-functions",
"format_version": 1,
"app": "formcut",
- "app_version": "2.21.0",
+ "app_version": "2.21.1",
"functions": [
{
"id": "transcribe",
diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md
index b5bdd1b1..b78659f3 100644
--- a/frontend/HASHOUT_LOG.md
+++ b/frontend/HASHOUT_LOG.md
@@ -2,7 +2,7 @@
Reasoning behind interface changes, newest first.
-## Unreleased · Storage chooses the models folder (`ui/start-screen.ts` renderStorage, modelsLine, the storage branch of show; `i18n/en.json`, `de.json`, `es.json`)
+## 2.21.1 · Storage chooses the models folder (`ui/start-screen.ts` renderStorage, modelsLine, the storage branch of show; `i18n/en.json`, `de.json`, `es.json`)
- **What it adds.** The home screen's Storage view gains a line under the usage summary, `Models folder: · free on disk`, with `used after formcut restarts`, `set by FORMCUT_MODELS_DIR` or `cannot be reached, so the default folder is in use` after it when that holds. Three chips in the view's actions row: **Choose models folder** (the engine's own folder dialog through `/api/system/choose` with `kind: "folder"`, then `PUT /api/storage/models-folder`), **Use the default folder** (`{"folder": null}`), and **Copy downloaded models** (`POST /api/storage/models-folder/copy`, followed with `waitJob`, progress in the status line).
- **No re-render.** `modelsLine` writes one `p.models-line` made once by `child()` and changes its text only when it differs, as `emptyNote` does; the chips are made once per visit to the view and only their `disabled` changes. The chips start disabled until the first answer, so nothing can be pressed against a folder not yet read. Seen in Chromium at 4x CPU and a slow network: no layout shift from opening Storage through Choose, Copy and Default.
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index afcc226d..42b1f7c7 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "formcut-frontend",
- "version": "2.21.0",
+ "version": "2.21.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "formcut-frontend",
- "version": "2.21.0",
+ "version": "2.21.1",
"dependencies": {
"@huggingface/transformers": "^4.3.0",
"@xterm/addon-fit": "0.11.0",
diff --git a/frontend/package.json b/frontend/package.json
index cf8a2fa7..4a25f4d4 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,6 +1,6 @@
{
"name": "formcut-frontend",
- "version": "2.21.0",
+ "version": "2.21.1",
"private": true,
"type": "module",
"scripts": {
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index b4b5bd3c..e5b5d1ff 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -878,7 +878,7 @@ dependencies = [
[[package]]
name = "formcut"
-version = "2.21.0"
+version = "2.21.1"
dependencies = [
"objc2",
"objc2-app-kit",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 69592e98..2ed18ec6 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "formcut"
-version = "2.21.0"
+version = "2.21.1"
edition = "2021"
[build-dependencies]
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index ea47ec15..64510f6b 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "FormCut",
- "version": "2.21.0",
+ "version": "2.21.1",
"identifier": "app.formcut.desktop",
"build": {
"frontendDist": "../frontend/dist"