- Notifications
You must be signed in to change notification settings - Fork1.1k
feat: add page for ai-bridge interception logs#20331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
request logs routingrequest logs routing321ce8c tocd9b38bCompare…#20410)Thanks to the great work in#20393, we’ve successfully introducedoffset-based pagination for this endpoint. However, the frontend expectsa `count` field in the response rather than `total`. This PR updates theresponse payload to rename the returned key to `count` for consistencywith frontend expectations and existing API patterns.This is necessary to unblock the work in#20331
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull Request Overview
This PR introduces basic routing and UI structure for the AI Governance Request Logs feature. It establishes a new/aigovernance/request-logs route with filtering capabilities, displaying AI request interceptions in a paginated table format.
Key changes:
- New route structure under
/aigovernancewith automatic redirect torequest-logssub-route - Request logs page with filtering by user and AI provider, displaying token usage and tool calls
- Navigation integration via the Admin settings dropdown menu
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| site/src/testHelpers/entities.ts | Added mock data entity for AI Bridge interceptions to support testing |
| site/src/router.tsx | Registered new AI Governance routes with lazy-loaded components |
| site/src/pages/AIGovernancePage/RequestLogsPage/filter/filter.tsx | Implemented provider filter menu for OpenAI and Anthropic |
| site/src/pages/AIGovernancePage/RequestLogsPage/filter/RequestLogsFilter.tsx | Created composite filter component combining user and provider filters |
| site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.tsx | Built expandable table row component displaying interception details |
| site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.stories.tsx | Added Storybook story for RequestLogsRow component |
| site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsPageView.tsx | Created main view component with paywall, filtering, and table rendering |
| site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsPageView.stories.tsx | Added Storybook stories covering various page states |
| site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsPage.tsx | Implemented page controller integrating filters and data fetching |
| site/src/pages/AIGovernancePage/AIGovernanceLayout.tsx | Created shared layout wrapper with header for AI Governance section |
| site/src/pages/AIGovernancePage/AIGovernanceHelpTooltip.tsx | Added help tooltip explaining AI Governance feature |
| site/src/modules/dashboard/Navbar/NavbarView.tsx | Updated navbar to accept and pass AI Governance visibility flag |
| site/src/modules/dashboard/Navbar/NavbarView.test.tsx | Updated tests to include new canViewAIGovernance prop |
| site/src/modules/dashboard/Navbar/Navbar.tsx | Added logic to determine AI Governance visibility based on feature flags |
| site/src/modules/dashboard/Navbar/DeploymentDropdown.tsx | Added AI Governance menu item to deployment dropdown |
| site/src/api/queries/aiBridge.ts | Created query configuration for paginated interceptions API |
| site/src/api/api.ts | Added API method to fetch AI Bridge interceptions |
Comments suppressed due to low confidence (1)
site/src/modules/dashboard/Navbar/DeploymentDropdown.tsx:38
- The conditional check for showing the dropdown is missing the newly added
canViewAIGovernanceflag. This means the dropdown won't appear when a user only has AI Governance permissions but none of the other admin permissions.
if (!canViewAuditLog &&!canViewConnectionLog &&!canViewOrganizations &&!canViewDeployment &&!canViewHealth) {💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.tsx OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsPage.tsx OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.stories.tsx OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.tsx OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| onSelect={(option:SelectFilterOption|undefined):void=> | ||
| menu.selectOption(option) | ||
| } | ||
| selectedOption={menu.selectedOption??undefined} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| selectedOption={menu.selectedOption??undefined} | |
| selectedOption={menu.selectedOption} |
| returnuseFilterMenu({ | ||
| id:"provider", | ||
| getSelectedOption:async()=> | ||
| AIBRIDGE_PROVIDERS.find((option)=>option.value===value)??null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| AIBRIDGE_PROVIDERS.find((option)=>option.value===value)??null, | |
| AIBRIDGE_PROVIDERS.find((option)=>option.value===value), |
why are you coercing it tonull just to immediately coerce itback toundefined?
site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsPageView.stories.tsxShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsPageView.stories.tsxShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsPageView.stories.tsxShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
also, the pr title may pass the bots vibe check but it's not very clear to me. maybe something like...
|
site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.tsxShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
site/src/pages/AIGovernancePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.tsxShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
request logs routingResolved issue from#20331 where the article `an` was incorrectly usedbefore words not beginning with a vowel sound. Updated affectedinstances to use the correct article `a`.```diff- You need an Premium license to use this feature.+ You need a Premium license to use this feature.```This was already correct on the following pages.*[`ConnectionLogPageView.tsx`](https://github.com/coder/coder/blob/7182c53df7648cd7db8551629226c4a0a1cc8559/site/src/pages/ConnectionLogPage/ConnectionLogPageView.tsx#L130)*[`GroupsPageView.tsx`](https://github.com/coder/coder/blob/7182c53df7648cd7db8551629226c4a0a1cc8559/site/src/pages/GroupsPage/GroupsPageView.tsx#L49)
Relates#20287
This pull-request introduces a basic routing for
AI Governance's Request Logs feature. Currently we're just pulling back the basics from the database and rendering it into the table. Nothing exciting.The idea is to extend further upon the
/aigovernanceroute so it has been appropriately wrapped with a<AIGovernanceLayout />to introduce a navigation later.