fix(admin-ui): add Chainlit chat shortcut - #635
Conversation
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds ChangesChainlit availability flag
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ui/src/components/layout/header.test.tsx (1)
30-32: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider asserting the
relattribute too.The test checks
hrefandtargetbut notrel="noopener noreferrer", which is the security-relevant attribute added alongsidetarget="_blank".✅ Suggested addition
const chatLink = screen.getByRole("link", { name: /chat/i }); expect(chatLink.getAttribute("href")).toBe("/chainlit/"); expect(chatLink.getAttribute("target")).toBe("_blank"); + expect(chatLink.getAttribute("rel")).toBe("noopener noreferrer");🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ui/src/components/layout/header.test.tsx` around lines 30 - 32, The header link test currently verifies href and target on chatLink but misses the security-related rel attribute. Update the existing assertion block in header.test.tsx to also check that the link rendered by the header component includes rel="noopener noreferrer" alongside target="_blank", using the same screen.getByRole("link", { name: /chat/i }) query.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@ui/src/components/layout/header.test.tsx`:
- Around line 30-32: The header link test currently verifies href and target on
chatLink but misses the security-related rel attribute. Update the existing
assertion block in header.test.tsx to also check that the link rendered by the
header component includes rel="noopener noreferrer" alongside target="_blank",
using the same screen.getByRole("link", { name: /chat/i }) query.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: db63cbff-ac95-4973-99fb-6a52a5bbddc5
📒 Files selected for processing (2)
ui/src/components/layout/header.test.tsxui/src/components/layout/header.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d98ec2b599
ℹ️ 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".
|
Verified ✅ — same-origin |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
openrag/api/routers/admin/users.py (1)
30-33: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider reusing the module-level
WITH_CHAINLIT_UIconstant frommain.pyinstead of re-parsing the env var.
_chainlit_enabled()duplicates the exact sameos.getenv("WITH_CHAINLIT_UI", "true").lower() == "true"logic already defined at module level inopenrag/api/main.py(line 95). While functionally equivalent, this creates two sources of truth for the same flag. If the parsing logic ever changes (e.g., accepting"1"or"yes"), one location may be missed.If importing from
main.pywould create a circular dependency, consider extracting the constant to a shared config/settings module that both files can import.Also applies to: 89-93
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@openrag/api/routers/admin/users.py` around lines 30 - 33, The `_chainlit_enabled()` helper is duplicating the `WITH_CHAINLIT_UI` parsing logic already defined at module level in `main.py`, creating two sources of truth. Update the admin users router to reuse the shared `WITH_CHAINLIT_UI` value instead of calling `os.getenv` again, and if importing from `main.py` would introduce a circular dependency, move the flag into a shared config/settings module that both `_chainlit_enabled()` and the `main.py` module-level constant can import.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@openrag/api/routers/admin/users.py`:
- Around line 30-33: The `_chainlit_enabled()` helper is duplicating the
`WITH_CHAINLIT_UI` parsing logic already defined at module level in `main.py`,
creating two sources of truth. Update the admin users router to reuse the shared
`WITH_CHAINLIT_UI` value instead of calling `os.getenv` again, and if importing
from `main.py` would introduce a circular dependency, move the flag into a
shared config/settings module that both `_chainlit_enabled()` and the `main.py`
module-level constant can import.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6e38b2d2-ab35-4131-8bf3-b2ca2481d0c3
📒 Files selected for processing (7)
openrag/api/main.pyopenrag/api/routers/admin/users.pytests/integration/api/test_users.pyui/src/components/layout/header.test.tsxui/src/components/layout/header.tsxui/src/lib/api/account.tsui/src/mocks/handlers.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- ui/src/components/layout/header.test.tsx
- ui/src/components/layout/header.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf3409e6d8
ℹ️ 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".
|
On the token-mode UX gap for the new Chat shortcut: accepting the current behavior for this PR. In token mode the shortcut opens Chainlit's login form (a one-time sign-in per Chainlit session), while OIDC mode is already seamless via the Tracked in #638. |
Bot review comments — dispositionAll automated review comments are now addressed, so this is ready to validate:
Follow-up (token-mode chat opens Chainlit's login instead of seamless SSO) is tracked separately in #638 and is out of scope here. CI is green and the change is frontend-scoped. |
Summary
Adds a small Chat button in the Admin UI header so admins and users can jump from the console to the Chainlit chat experience without manually changing URLs.
The link uses the existing same-origin
/chainlit/route, so it works through the Admin UI nginx proxy and does not hardcode a server IP or backend port.Validation
npm test -- --run src/components/layout/header.test.tsxnpm run lintnpm run buildhttp://localhost:8068/app/partitionsNotes
This is frontend-only. It does not change backend routing or authorization.
Summary by CodeRabbit
chainlit_enabledflag in admin/config and authenticated user info so the UI can conditionally show the button.hrefbehavior when enabled/disabled.chainlit_enabledis returned as a boolean.