-
Notifications
You must be signed in to change notification settings - Fork 26
feat(devops-copilot): add copilot configuration panel #2156
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Conversation
|
Qovery can create a Preview Environment for this PR.
This comment has been generated from Qovery AI 🤖.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## staging #2156 +/- ##
===========================================
- Coverage 48.68% 48.04% -0.64%
===========================================
Files 1161 1204 +43
Lines 20226 21235 +1009
Branches 6000 6235 +235
===========================================
+ Hits 9847 10203 +356
- Misses 8489 9122 +633
- Partials 1890 1910 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/qovery preview all |
|
Preview environments were automatically created via Qovery. Another comment will be posted when deployments are finished |
|
Your preview environment failed to be deployed ! |
|
Your preview environment has been successfully deployed ! |
- Add read/write mode toggle in conversation header (locked after first message) - Add warning callout when read-write mode is enabled - Add delete recurring task functionality with confirmation - Pass readOnly to thread creation
0dd776b to
5458377
Compare
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.
Thanks @killiancolla 🙏
Here are my comments on the PR.
Next time, could you please add a short explanation of how and where we can test it? Since we don’t have the full context of your task, this information is necessary to review it properly
Also, please be careful with AI-generated code. You are responsible for any code you include, so make sure to test it and verify its performance. That part is not the reviewers’ job
You can check the codebase documentation in .cursor or in AGENT.md, and I’m happy to jump on a call if you need a clearer explanation of the codebase
-
The
devops-copilot-panelcomponent is too large and contains too many lines. We need to refactor it and split it into smaller parts -
You need to add some unit tests to cover your code
-
The loader is too big and not consistent with what we use elsewhere in the codebase. Please take inspiration from other settings pages. Also, the loading time is quite long, can we optimise it?
- The design isn't correct and ISO with other element, could you validate it with a designer? (cc: @TheoGrandin74 )
- We don't have this color in the code base for "disable" btn
- We should probably use
BlockContentinstead of a custom block to stay consistent with other settings pages - The Read-Write mode should be a
Calloutcomponent this one is custom
| }, | ||
| }), | ||
| recurringTasks: ({ organizationId }: { organizationId: string }) => ({ | ||
| queryKey: [organizationId, 'recurring-tasks'], |
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.
| queryKey: [organizationId, 'recurring-tasks'], | |
| queryKey: [organizationId], |
It is not necessary to add recurring-tasks it's already add by default
| {isFeatureFlagPanel && !isCopilotEnabled && ( | ||
| <> | ||
| <br></br> | ||
| <br></br> |
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.
The margins should be done with CSS not br
libs/shared/devops-copilot/feature/src/lib/devops-copilot-panel/devops-copilot-panel.tsx
Show resolved
Hide resolved
| throw new Error('Organization ID is required but not provided in context') | ||
| } | ||
|
|
||
| // First, create a new thread |
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.
Remove this useless comment please 🙏
Try do keep only necessary comment when it's generate by IA !
| @@ -0,0 +1,13 @@ | |||
| import { render } from '__tests__/utils/setup-jest' | |||
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.
This one is deprecated you need to use import { renderWithProviders } from '@qovery/shared/util-tests'
| @@ -0,0 +1,9 @@ | |||
| import { render } from '__tests__/utils/setup-jest' | |||
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.
This one is deprecated
| import { render } from '__tests__/utils/setup-jest' | |
| import { renderWithProviders } from '@qovery/shared/util-tests' |
| last_error?: string | ||
| } | ||
|
|
||
| export function PageOrganizationAICopilot(props: PageOrganizationAICopilotProps) { |
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.
All this page should be renamed and inside the copilot library like AICopilotSettings
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.
@killiancolla It’s not exactly what I expected, the whole setting page can be inside your domain and you can renamed it something like AICopilotSettings, with the section inside if you prefer.
Let me know if anything is unclear! 🙏
|
|
||
| queryClient.setQueryData( | ||
| devopsCopilot.config({ organizationId: organization?.id ?? '' }).queryKey, | ||
| (old: any) => ({ |
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.
You can't use any
| {isEnabled && ( | ||
| <div className="space-y-4 rounded border border-neutral-250 bg-neutral-100 p-6"> | ||
| <div className="space-y-2"> | ||
| <label className="text-sm font-medium text-neutral-400">Access Mode</label> |
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.
This one should be a Heading ?
| <div> | ||
| <p className="mb-1 font-medium text-neutral-400">1. Data Collection and Usage</p> | ||
| <p> | ||
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut |
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.
Could you add real text? We can't merge lorem ipsum in production
|
Thanks @RemiBonnet for the detailed feedback 🙏 |
…gn feedback - separate sections with dedicated BlockContent and Section components - reduce LoaderSpinner size - replace custom information section with Callout "sky" component - add confirmation modals for "Disable" and "Delete" task actions - update "Disable" button styling (color change, icon removal) - replace "Pause"/"Resume" and status badge with InputToggle component - replace "Delete" button with icon button and update color - align tasks list styling with codebase patterns
…ality - Split PageOrganizationAICopilot into smaller components (OptIn, Configuration, ScheduledTasks) - Replace deprecated test import - Replace <br> tags with CSS margin classes - Use Link component and URL constants
- Add useRecurringTasks and useConfig hook - Remove useless comments, condition and parameters
- Rename feature flag variable: isFeatureFlagPanel -> isDevopsCopilotPanelFeatureFlag - Extract mutations into custom hooks (useToggleRecurringTask, useDeleteRecurringTask, useUpdateOrgConfig) - Use react-hook-form for T&C acceptance - Use Icon component with iconName prop instead of name prop - Remove width and height props from Icon components
|
Hey @RemiBonnet, I've addressed your comments, here's the changes I've made: Refactoring
UI/UX improvements
Code quality
Testing
You can test it all by navigating to the configuration panel for the Qovery Realm organization here. Don’t hesitate to tell me if you have some feedback or question! |
| last_error?: string | ||
| } | ||
|
|
||
| export function PageOrganizationAICopilot(props: PageOrganizationAICopilotProps) { |
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.
@killiancolla It’s not exactly what I expected, the whole setting page can be inside your domain and you can renamed it something like AICopilotSettings, with the section inside if you prefer.
Let me know if anything is unclear! 🙏
RemiBonnet
left a comment
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.
Well done, it's much better than before, I added a few comments, and it should be nice now!
| import { renderHook } from '@qovery/shared/util-tests' | ||
| import { useAICopilotRecurringTasks } from './use-ai-copilot-recurring-tasks' | ||
|
|
||
| jest.mock('@tanstack/react-query', () => ({ |
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.
The tests with react-query for hooks aren't necessary, you can remove it (for other hook as well)
| import { useAuth0 } from '@auth0/auth0-react' | ||
| import { useEffect, useState } from 'react' | ||
| import { type Thread } from '../../devops-copilot-panel/devops-copilot-panel' | ||
| import { type Thread } from '../../devops-copilot-panel/devops-copilot-panel.types' |
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.
necessary?
| @@ -0,0 +1,8 @@ | |||
| export { DevopsCopilotPanel } from './devops-copilot-panel' | |||
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.
Theses export aren't really necessary here, could you export directly from the files ?
| import SectionScheduledTasks from './section-scheduled-tasks/section-scheduled-tasks' | ||
|
|
||
| export interface AICopilotSettingsProps { | ||
| organization?: Organization |
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.
should be required no?
… DevopsCopilotContext type to CopilotContextData to avoid naming conflict with React Context
RemiBonnet
left a comment
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.
LGTM 👍
| export function useAICopilotRecurringTasks({ organizationId }: UseAICopilotRecurringTasksProps) { | ||
| return useQuery({ | ||
| ...devopsCopilot.recurringTasks({ organizationId }), | ||
| enabled: !!organizationId, |
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.
| enabled: !!organizationId, |
Useless if organizationId is required
libs/shared/devops-copilot/feature/src/lib/ai-copilot-settings/ai-copilot-settings.tsx
Outdated
Show resolved
Hide resolved
...ib/ai-copilot-settings/section-ai-copilot-configuration/section-ai-copilot-configuration.tsx
Outdated
Show resolved
Hide resolved
...ib/ai-copilot-settings/section-ai-copilot-configuration/section-ai-copilot-configuration.tsx
Outdated
Show resolved
Hide resolved
...ib/ai-copilot-settings/section-ai-copilot-configuration/section-ai-copilot-configuration.tsx
Outdated
Show resolved
Hide resolved
...ilot/feature/src/lib/ai-copilot-settings/section-scheduled-tasks/section-scheduled-tasks.tsx
Outdated
Show resolved
Hide resolved
.../devops-copilot/feature/src/lib/devops-copilot-panel/assistant-message/assistant-message.tsx
Outdated
Show resolved
Hide resolved
...feature/src/lib/devops-copilot-panel/hooks/use-message-submission/streaming-state-reducer.ts
Outdated
Show resolved
Hide resolved
.../devops-copilot/feature/src/lib/devops-copilot-panel/streaming-message/streaming-message.tsx
Outdated
Show resolved
Hide resolved
- Extract modal content - Replace mermaidRenderCache logic with useMemo - Memoize string processing logic
What does this PR do?
This PR integrates the Copilot configuration panel with the following features:
PR Checklist