Feat/base path and root path - #252
Conversation
Both are opt-in and default to today's behaviour, so the GitHub Pages and dedicated-host deploys are unchanged. UI — NEXT_PUBLIC_BASE_PATH sets Next's `basePath` at build time (a static export inlines every URL, so it cannot be a runtime setting). Note the asymmetry that makes this alone insufficient: basePath rewrites the URLs inside the HTML but still writes the files at the root of `out/`, so the reverse proxy has to strip the prefix as well. Next prefixes what it controls — <Link>, router.push, and every _next/* asset — but not files served from `public/` and referenced by a literal path, nor plain <a href> anchors. Those were silently broken under a prefix: the favicon on every page, an illustration, and two internal links. They now go through `withBasePath()`, a no-op when no prefix is configured. API — ROOT_PATH sets FastAPI's `root_path`, so the /docs page advertises a reachable /<prefix>/openapi.json instead of a root-relative one that would land on whatever else is served at the site root. It does not change the routes the app matches. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ale (#251) llama-server e llama-swap parlano il formato OpenAI, quindi il branch usa agent_framework.openai.OpenAIChatClient — gia' presente nel pacchetto core agent-framework, nessuna dipendenza nuova. Due trappole gestite esplicitamente nel client: - l'SDK OpenAI tratta base_url come radice dell'API e ci appende "/chat/completions", quindi il /v1 deve farne parte. LLAMACPP_BASE_URL e' accettata con o senza, e normalizzata. - senza api_key l'SDK ripiegherebbe su OPENAI_API_KEY dall'ambiente, spedendo i prompt a OpenAI invece che al server locale. Quando LLAMACPP_API_KEY non e' impostata si passa una chiave fittizia: llama-server senza --api-key ignora comunque l'header. Introdotto is_self_hosted(provider) per llamacpp+ollama, che governa i due comportamenti finora legati al solo "ollama": gate di accesso LLM aperto (nessun costo per chiamata da tariffare) e report territorio in modalita' sintetica (modelli locali compatti). Cambio non retrocompatibile: il fallback di LLM_PROVIDER=auto senza credenziali passa da ollama a llamacpp. Chi ci contava implicitamente deve dichiarare LLM_PROVIDER=ollama. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1273ed17a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if settings.ollama_cloud_api_key: | ||
| return "ollama_cloud" | ||
| return "ollama" | ||
| return "llamacpp" |
There was a problem hiding this comment.
Keep the default CPU stack on its bundled Ollama provider
With the documented make up flow, .env.local.example leaves LLM_PROVIDER=auto and Makefile routes up to up-cpu, which starts ollama-cpu but no llama.cpp server. This fallback therefore directs every LLM request to host.docker.internal:8080, where a fresh setup has nothing listening, while the bundled Ollama container is ignored. Either force LLM_PROVIDER=ollama in the CPU/GPU targets or include and validate the new inference server in the default stack.
Useful? React with 👍 / 👎.
| # Path prefix the app is served under, e.g. `/opendata` when it shares a | ||
| # hostname with other projects. Empty (the default) keeps the bundle rooted. | ||
| ARG NEXT_PUBLIC_BASE_PATH |
There was a problem hiding this comment.
Forward the base-path argument from supported image builds
Declaring this build argument is insufficient for the repository's supported build paths: the opendata-ai-ui build args in docker-compose.yml and the build-args block in .github/workflows/docker-publish.yml forward the other NEXT_PUBLIC_* values but not NEXT_PUBLIC_BASE_PATH. Consequently, setting the new variable in the compose environment or GitHub repository variables still produces a root-based static bundle, so the advertised prefixed deployment fails unless someone bypasses both build paths and invokes Docker manually.
Useful? React with 👍 / 👎.
| images: { unoptimized: true }, | ||
| poweredByHeader: false, | ||
| trailingSlash: true, | ||
| ...(basePath ? { basePath } : {}), |
There was a problem hiding this comment.
Make OIDC redirects honor the configured base path
When a prefixed build also has OIDC enabled, authentication remains rooted at the host: lib/oidc.ts::redirectUri() returns ${window.location.origin}/, and logout uses the same root-relative destination. On the shared-host deployment this feature targets, the identity provider therefore returns the authorization code to another application at /, so this UI never processes the callback and protected pages cannot be used. The callback, post-logout, and local logout destinations need to include the configured base path.
Useful? React with 👍 / 👎.
Summary
Explain what this PR changes and why.
Type of change
Verification
Describe how you tested or manually verified the change.
Data/source grounding
If this PR changes data discovery, summarization, scoring or reports, list the public sources or examples used for verification.
Checklist