Pull requests / #1202
#1202 dashboard: Serve the web page under an optional dashboard path
open · @gener-vscode · 0 comentarios · En GitHub
Setup & installServer & APISecurityDocumentationLinux
Descripción
### What The web page answered only at `/`, so nothing else could hold that address on the same port. A run-config key `"dashboard"` (or `serve/server.py --dashboard /ui`) now serves the page under a path of the user's choosing, together with the files the page loads for itself: | with `"dashboard": "/ui"` | answer | |---|---| | `/ui/` | the chat page (Chat / Monitor / About) | | `/ui/web/app.js`, `/ui/web/app.css`, `/ui/web/sprite.svg`, `/ui/fonts/*` | the styles, script, sprite and font the page loads itself | | `/` and `/ui`, asked with GET | `301` to `/ui/`, keeping a `?q=` that came with it (`/?q=hi` to `/ui/?q=hi`) | | `/v1/chat/completions`, `/v1/messages`, `/v1/responses`, `/health`, `/metrics`, `/status`, `/slots`, `/props`, `/models`, `/mcp`, `/load`, `/unload` | unchanged, at `/` as they always were; the same paths answer under `/ui/` too, which is what the page produces when it asks by relative URL (#82) | | a POST to `/`, or one of the page files asked for at its old address | `404`, naming where they moved | With nothing set - or `"/"` - every path means what it always meant. ### Why it matters A page of the user's own or a reverse proxy can hold the root, and the API of Strata needs no change: no client changes its base URL, and the dashboard - which already asks for its files and for the API by relative URL (#82) - reaches both spellings. `/ui` without the trailing slash moves with a 301 because a browser would otherwise resolve those relative URLs against `/`; a bookmark or an old link to `/` lands on the page the same way, which is what `/` answered until now. A POST to `/` is not moved: it is aimed at the API, and a 301 would turn it into a GET of the page. The path is checked before the model loads: names of letters, digits, `-` or `_` between slashes, at most 60 characters, and never one of the paths this server answers itself (`/web`, `/v1`, `/fonts`, `/api`, `/metrics`, `/health`, `/api-monitor`, ...). A wrong value stops the start with a message naming the flag and the key. ### Tests `WebApp.test_the_whole_app_can_move_to_another_path` covers both halves: at the default every path is unchanged; with `/ui` the page and its files answer under it, `/` and `/ui` answer `301` - read over a plain connection, since urllib follows a redirect by itself - the API answers at either spelling for GET and POST, and a POST at the root stays an error. Measured on Linux with Python 3.12, mock engine, no GPU and no download: - `python -m unittest serve.test_server serve.test_monitor serve.test_security` -> 238 tests OK - `python -m unittest serve.test_runconfig` -> 9 OK; `python tools/test_setup_choices.py` -> 35 OK - a live server with `--dashboard /ui`: `GET /` -> `HTTP/1.0 301` with `Location: /ui/`; `GET /?q=hi` -> `301` to `/ui/?q=hi`; `curl -L /` -> `200` at `http://127.0.0.1:8097/ui/`; `POST /` -> 404; `GET /web/app.js` -> 404; `/ui/` and `/v1/models` -> 200. The same server without the flag: `/` -> 200, as before. ### Docs and the rest `docs/DETAILS.md` documents the key and what each path answers. `serve/web/monitor.html` and `monitor.js` move from absolute to relative paths so the monitor page works under the new path too, and `sycl/serve/server_intel.py` reuses the same routing, so the Arc wrapper follows the same rules. The READMEs, `docs/INSTALL.md`, `docs/AI_SETUP.md` and `setup.py` only spell the default address with its trailing slash. ### Commits - `a28bcd8` feat(serve): serve the web page under an optional "dashboard" path - `54422de` fix(serve): / redirects to the dashboard path instead of answering 404
En el sitio
Enlaces a install, modelos, releases.