Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat: build webv2 frontend via make and serve it with invokeai-web --webv2
Lincoln Steincc46885c07f0
diff --git a/Makefile b/Makefileindex 9830f7167f..c231053a7d 100644--- a/Makefile+++ b/Makefile@@ -13,6 +13,8 @@ help:@echo "test Run the unit tests."@echo "frontend-install Install the pnpm modules needed for the frontend"@echo "frontend-build Build the frontend for localhost:9090"+ @echo "frontendv2-install Install the pnpm modules needed for the webv2 frontend"+ @echo "frontendv2-build Build the webv2 frontend for localhost:9090"@echo "frontend-test Run the frontend test suite once"@echo "frontend-dev Run the frontend in developer mode on localhost:5173"@echo "frontend-openapi Generate the OpenAPI schema"@@ -57,6 +59,15 @@ frontend-install:frontend-build:cd invokeai/frontend/web && pnpm build+# Install the pnpm modules needed for the webv2 front end+frontendv2-install:+ rm -rf invokeai/frontend/webv2/node_modules+ cd invokeai/frontend/webv2 && pnpm install++# Build the webv2 frontend+frontendv2-build:+ cd invokeai/frontend/webv2 && pnpm build+# Run the frontend test suite oncefrontend-test:cd invokeai/frontend/web && pnpm run test:rundiff --git a/invokeai/app/api_app.py b/invokeai/app/api_app.pyindex 8c0252dcc7..8b42e6b91b 100644--- a/invokeai/app/api_app.py+++ b/invokeai/app/api_app.py@@ -49,6 +49,7 @@ from invokeai.app.api.sockets import SocketIOfrom invokeai.app.services.config.config_default import get_configfrom invokeai.app.util.custom_openapi import get_openapi_funcfrom invokeai.backend.util.logging import InvokeAILogger+from invokeai.frontend.cli.arg_parser import InvokeAIArgsapp_config = get_config()logger = InvokeAILogger.get_logger(config=app_config)@@ -588,6 +589,9 @@ def overridden_redoc(request: Request) -> HTMLResponse:web_root_path = Path(list(web_dir.__path__)[0])+ui_root_path = web_root_path+if InvokeAIArgs.did_parse and getattr(InvokeAIArgs.args, "webv2", False):+ ui_root_path = web_root_path.parent / "webv2"if app_config.unsafe_disable_picklescan:logger.warning(@@ -596,9 +600,9 @@ if app_config.unsafe_disable_picklescan:)try:- app.mount("/", NoCacheStaticFiles(directory=Path(web_root_path, "dist"), html=True), name="ui")+ app.mount("/", NoCacheStaticFiles(directory=Path(ui_root_path, "dist"), html=True), name="ui")except RuntimeError:- logger.warning(f"No UI found at {web_root_path}/dist, skipping UI mount")+ logger.warning(f"No UI found at {ui_root_path}/dist, skipping UI mount")app.mount("/static", NoCacheStaticFiles(directory=Path(web_root_path, "static/")), name="static") # docs favicon is in herediff --git a/invokeai/frontend/cli/arg_parser.py b/invokeai/frontend/cli/arg_parser.pyindex 72da8f7656..1ff3a08485 100644--- a/invokeai/frontend/cli/arg_parser.py+++ b/invokeai/frontend/cli/arg_parser.py@@ -13,6 +13,8 @@ _config_file_help = r"""Path to the invokeai.yaml configuration file. If omitted_parser = ArgumentParser(description="Invoke Studio", formatter_class=RawTextHelpFormatter)_parser.add_argument("--root", type=str, help=_root_help)_parser.add_argument("--config", dest="config_file", type=str, help=_config_file_help)+_webv2_help = r"""Serve the webv2 frontend (invokeai/frontend/webv2) instead of the legacy web frontend. The webv2 frontend must be built first (make frontendv2-build)."""+_parser.add_argument("--webv2", action="store_true", help=_webv2_help)_parser.add_argument("--version", action="version", version=__version__, help="Displays the version and exits.")