Skip to content

fix(gensui): correct frontend dist path resolution#13

Open
wstlima wants to merge 1 commit into
AlphaHorizon-AI:mainfrom
wstlima:fix/gensui-frontend-path
Open

fix(gensui): correct frontend dist path resolution#13
wstlima wants to merge 1 commit into
AlphaHorizon-AI:mainfrom
wstlima:fix/gensui-frontend-path

Conversation

@wstlima

@wstlima wstlima commented Jul 10, 2026

Copy link
Copy Markdown

Fixes #5

Summary

  • GENSUI_ROOT resolves to /app/gensui (the Python package dir), but the Docker image places the built frontend one level up at /app/frontend/dist
  • frontend_dist.exists() was always False inside the container, so / and the SPA catch-all routes were never registered — every request to the root returned FastAPI's default 404

Reproduction (before fix)

curl -s http://127.0.0.1:8787/
# {"detail":"Not Found"}

docker exec gensui ls /app/frontend/dist/index.html
# file exists — the built frontend is present and intact, just not found by app.py

Fix

Try GENSUI_ROOT.parent / "frontend" / "dist" first (matches the Docker layout), falling back to the original path if that doesn't exist — preserves the local install.sh install path.

Test plan

  • curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:8787/200
  • SPA client-side routes still resolve to index.html

GENSUI_ROOT (gensui/config.py:14) resolves to /app/gensui — the
Python package directory. app.py used GENSUI_ROOT / "frontend" / "dist"
to locate the built admin UI, but the Docker image places the built
frontend one level up, at /app/frontend/dist (see gensui/Dockerfile:31,
`COPY --from=frontend-builder /app/frontend/dist ./frontend/dist`
under WORKDIR /app).

Effect: frontend_dist.exists() was always False inside the container,
so the `/` route and the SPA catch-all were never registered. Every
request to the root or any client-side route returned FastAPI's
default 404:

  $ curl -s http://127.0.0.1:8787/
  {"detail":"Not Found"}

...despite the built files being present and intact:

  $ docker exec gensui ls /app/frontend/dist/index.html
  /app/frontend/dist/index.html

Fix: try GENSUI_ROOT.parent / "frontend" / "dist" first (matches the
Docker layout), falling back to the original GENSUI_ROOT / "frontend"
/ "dist" if that doesn't exist — preserves behavior for the local
`install.sh` install path, which may lay out files differently.

After fix:
  $ curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:8787/
  200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gensui/app.py: frontend dist path resolves to the wrong directory, root route always 404s

1 participant