Extract optional dependencies

This commit is contained in:
imartinez 2024-02-28 20:28:30 +01:00
parent d0a7d991a2
commit 3373e80850
7 changed files with 255 additions and 416 deletions

View file

@ -52,7 +52,12 @@ def create_app(root_injector: Injector) -> FastAPI:
if settings.ui.enabled:
logger.debug("Importing the UI module")
from private_gpt.ui.ui import PrivateGptUi
try:
from private_gpt.ui.ui import PrivateGptUi
except ImportError as e:
raise ImportError(
"UI dependencies not found, install with `poetry install --extras ui`"
) from e
ui = root_injector.get(PrivateGptUi)
ui.mount_in_app(app, settings.ui.path)