mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-08-26 17:31:34 +00:00
fix(dashboard): log clearly when the built frontend is missing
Previously, if meshai/dashboard/static/ (or its index.html) was absent, create_app() silently skipped mounting /assets and registering the root/catch-all routes -- no log, no error. Any request to "/" would just 404 with FastAPI's generic "Not Found", giving no clue why. This was latent before (Docker always builds the frontend, and a git checkout with the artifacts committed always had the directory), but now that static/ is untracked, a fresh pip install without the frontend build step will hit this path as its first real-world trigger. Add a warning log naming the missing path and the exact build command, and make clear the bot/API are unaffected -- only the dashboard UI is absent.
This commit is contained in:
parent
69b72d76ce
commit
f5b3f85b86
1 changed files with 15 additions and 1 deletions
|
|
@ -93,7 +93,7 @@ def create_app() -> FastAPI:
|
|||
static_dir = Path(__file__).parent / "static"
|
||||
index_html = static_dir / "index.html"
|
||||
|
||||
if static_dir.exists():
|
||||
if static_dir.exists() and index_html.exists():
|
||||
# Mount /assets for JS, CSS, images
|
||||
assets_dir = static_dir / "assets"
|
||||
if assets_dir.exists():
|
||||
|
|
@ -114,6 +114,20 @@ def create_app() -> FastAPI:
|
|||
@app.get("/")
|
||||
async def root():
|
||||
return FileResponse(index_html)
|
||||
else:
|
||||
# meshai/dashboard/static/ is a build artifact, not committed to the
|
||||
# repo (see .gitignore) -- it only exists if the frontend has been
|
||||
# built. Without it there's no route for "/", so requests would
|
||||
# otherwise 404 with no explanation. Log loudly so a fresh
|
||||
# `pip install -e .` user knows the bot/API are fine and just the
|
||||
# dashboard UI needs building.
|
||||
logger.warning(
|
||||
"Dashboard UI not found at %s -- the web dashboard will NOT be served "
|
||||
"(the bot and API are unaffected). Build it with: "
|
||||
"cd dashboard-frontend && npm ci && npm run build "
|
||||
"(then restart meshai). Docker images build this automatically.",
|
||||
index_html,
|
||||
)
|
||||
|
||||
return app
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue