Update documentation and CLI behavior for GPU management

- Clarified the behavior of `Ctrl+C` and `Ctrl+D` in the README and other documentation, specifying that `Ctrl+C` only stops the tunnel while keeping the GPU active, and `Ctrl+D` stops the GPU while preserving disk data.
- Enhanced the CLI documentation to reflect these changes, ensuring users understand the implications of these commands during GPU operations.
- Improved the handling of data bindings and remounting logic in the codebase to prevent issues with empty model tabs in the UI.
- Added tests to validate the new command behaviors and ensure proper documentation alignment.
This commit is contained in:
Leonid Pershin
2026-08-21 13:25:55 +03:00
parent 1d18ece17b
commit f437cd0373
26 changed files with 712 additions and 142 deletions
+35
View File
@@ -97,6 +97,23 @@ def swarm_api_bits() -> str:
"current_model": val.get("current_model"),
}
chunks.append("ListBackends=" + json.dumps(summary, ensure_ascii=False, indent=2))
try:
listed = _post(
"/API/ListModels",
{
"session_id": sid,
"path": "",
"depth": 3,
"subtype": "Stable-Diffusion",
},
)
files = listed.get("files") if isinstance(listed, dict) else None
folders = listed.get("folders") if isinstance(listed, dict) else None
nfiles = len(files) if isinstance(files, list) else "?"
nfolders = len(folders) if isinstance(folders, list) else "?"
chunks.append(f"ListModels Stable-Diffusion files={nfiles} folders={nfolders}")
except Exception as exc:
chunks.append(f"ListModels fail: {exc}")
# Full settings for first backend (StartScript path matters)
for key, val in (backends or {}).items():
if isinstance(val, dict) and val.get("settings"):
@@ -125,6 +142,24 @@ def paths_bits() -> str:
f"Backends.fds exists={BACKENDS_FDS.is_file()}",
]
rows.append("findmnt /opt/swarmui/dlbackend:\n" + _run(["findmnt", "/opt/swarmui/dlbackend"]))
rows.append("findmnt /opt/swarmui/Models:\n" + _run(["findmnt", "/opt/swarmui/Models"]))
data_models = DATA / "Models"
opt_models = Path("/opt/swarmui/Models")
def _n_weights(root: Path) -> int:
if not root.is_dir():
return 0
n = 0
try:
for p in root.rglob("*"):
if p.suffix.lower() in {".safetensors", ".ckpt", ".sft"}:
n += 1
except OSError:
return -1
return n
rows.append(
f"weights data={_n_weights(data_models)} swarm={_n_weights(opt_models)}"
)
if SETTINGS.is_file():
try:
for line in SETTINGS.read_text(encoding="utf-8", errors="replace").splitlines():