mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-31 00:03:01 +03:00
fix(tui): avoid blocking local gateway startup
This commit is contained in:
@@ -192,10 +192,9 @@ def _prepare_webui_bundle_for_gateway(
|
|||||||
return typer.confirm(message, default=True)
|
return typer.confirm(message, default=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# A source checkout is the development product. Every gateway entrypoint
|
# Interactive WebUI commands keep source and bundle in lockstep.
|
||||||
# keeps its browser client in lockstep with Python; only Vite mode skips
|
# Warn-only gateway startup must not block on a frontend build.
|
||||||
# the production bundle intentionally.
|
if mode not in {"skip", "warn"} and inspect_webui_bundle().source_available:
|
||||||
if mode != "skip" and inspect_webui_bundle().source_available:
|
|
||||||
mode = "auto"
|
mode = "auto"
|
||||||
ensure_webui_bundle(
|
ensure_webui_bundle(
|
||||||
mode=mode,
|
mode=mode,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from nanobot.cli.webui_support import _prepare_webui_bundle_for_gateway
|
|||||||
from nanobot.config.schema import Config
|
from nanobot.config.schema import Config
|
||||||
|
|
||||||
|
|
||||||
def test_source_checkout_rebuilds_the_webui_from_every_gateway_entrypoint(monkeypatch) -> None:
|
def test_source_checkout_preserves_warn_only_gateway_startup(monkeypatch) -> None:
|
||||||
modes: list[str] = []
|
modes: list[str] = []
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"nanobot.cli.webui_support.inspect_webui_bundle",
|
"nanobot.cli.webui_support.inspect_webui_bundle",
|
||||||
@@ -18,7 +18,7 @@ def test_source_checkout_rebuilds_the_webui_from_every_gateway_entrypoint(monkey
|
|||||||
|
|
||||||
_prepare_webui_bundle_for_gateway(Config(), mode="warn")
|
_prepare_webui_bundle_for_gateway(Config(), mode="warn")
|
||||||
|
|
||||||
assert modes == ["auto"]
|
assert modes == ["warn"]
|
||||||
|
|
||||||
|
|
||||||
def test_vite_mode_does_not_build_the_source_webui_bundle(monkeypatch) -> None:
|
def test_vite_mode_does_not_build_the_source_webui_bundle(monkeypatch) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user