diff options
Diffstat (limited to 'app/backends/__init__.py')
| -rw-r--r-- | app/backends/__init__.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/backends/__init__.py b/app/backends/__init__.py index 192067c..e59c464 100644 --- a/app/backends/__init__.py +++ b/app/backends/__init__.py @@ -18,8 +18,10 @@ importing this package must stay cheap and dependency-free. Adding a backend: create ``backends/<name>.py`` exposing ``detect() -> BackendStatus``, ``setup_screen(stdscr) -> int`` (the setup wizard run on the hub's own screen) and ``uninstall() -> int``, then append -a ``BackendInfo`` in ``_build_registry`` below. ``audiobook.py`` and the hub -pick it up automatically. A backend's standalone CLI keeps its own +a ``BackendInfo`` in ``_build_registry`` below. Optionally expose a +``configure_screen(stdscr) -> int`` to give the hub's "Configure <label>" +entry somewhere to go besides re-running the wizard. ``audiobook.py`` and +the hub pick it up automatically. A backend's standalone CLI keeps its own ``run_tui()`` entry (its own curses session), which is not part of the registry. """ @@ -158,12 +160,20 @@ class BackendInfo: removes the backend (stops its servers, pip-uninstalls, deletes its files); the hub runs it inside the task view, calling it with optional ``emit``/``cancel`` keywords (cancel honored between phases only). + + CONFIGURE_SCREEN, when given, is what the hub's "Configure <label>" + menu entry runs instead of SETUP_SCREEN once the backend exists — a + place for install-time-independent management (qwen uses it for its + per-model weight installs). Without one, the hub falls back to + SETUP_SCREEN; a backend whose wizard asks nothing (bare qwen) offers + no Configure entry at all. """ key: str label: str detect: Callable[[], BackendStatus] setup_screen: Callable[[object], int] uninstall: Callable[..., int] = lambda *args, **kwargs: 0 + configure_screen: Optional[Callable[[object], int]] = None REGISTRY: List[BackendInfo] = [] @@ -189,6 +199,7 @@ def _build_registry() -> None: detect=qwen.detect, setup_screen=qwen.setup_screen, uninstall=qwen.uninstall, + configure_screen=qwen.models_screen, )) REGISTRY.append(BackendInfo( key="faster", |
