-
Notifications
You must be signed in to change notification settings - Fork 45.7k
feat(platform/library): Allow sorting Agents by Last Execution Time #9871
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: dev
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
This PR targets the Automatically setting the base branch to |
Here's the code health analysis summary for commits Analysis Summary
|
✅ Deploy Preview for auto-gpt-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for auto-gpt-docs-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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 support for sorting agents by their last execution time in the Library view.
- Added LAST_EXECUTION to the sort enum in types.ts.
- Updated the library-sort-menu UI to display a "Last Run" option and to use the proper placeholder text.
- Changed the default sort behavior in state-provider.tsx to use LAST_EXECUTION.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts | Added new enum value LAST_EXECUTION to support sorting by last execution time. |
autogpt_platform/frontend/src/components/library/library-sort-menu.tsx | Modified the dropdown to include a "Last Run" option and updated placeholder text logic accordingly. |
autogpt_platform/frontend/src/app/(platform)/library/state-provider.tsx | Updated the default sort state from UPDATED_AT to LAST_EXECUTION. |
Hey @Keerthi421, welcome to the AutoGPT community! To help us get this merged, could you please run the formatter and sign the CLA? |
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.
Thank you for picking this up! This PR is still missing an important piece though: it adds a frontend option lastExecution
, but this sorting option also needs a backend implementation!
The enum is defined here:
AutoGPT/autogpt_platform/backend/backend/server/v2/library/model.py
Lines 233 to 237 in 3533961
class LibraryAgentSort(str, Enum): | |
"""Possible sort options for sorting library agents.""" | |
CREATED_AT = "createdAt" | |
UPDATED_AT = "updatedAt" |
Check out all of its references to find the other code that needs to be updated.
@@ -28,13 +28,26 @@ export default function LibrarySortMenu(): React.ReactNode { | |||
setAgentLoading(false); | |||
}; | |||
|
|||
const getPlaceholderText = () => { |
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.
pls make this a memoized variable placeholderText
switch (librarySort) { | ||
case LibraryAgentSortEnum.CREATED_AT: | ||
return "Creation Date"; | ||
case LibraryAgentSortEnum.UPDATED_AT: | ||
return "Last Modified"; | ||
case LibraryAgentSortEnum.LAST_EXECUTION: | ||
return "Last Run"; | ||
default: | ||
return "Last Modified"; | ||
} |
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.
nit: I'd use an object mapping instead (e.g. { LibraryAgentSortEnum.CREATED_AT: "Creation Date", ... }[librarySort]
)
@@ -44,6 +57,9 @@ export default function LibrarySortMenu(): React.ReactNode { | |||
<SelectItem value={LibraryAgentSortEnum.UPDATED_AT}> | |||
Last Modified | |||
</SelectItem> | |||
<SelectItem value={LibraryAgentSortEnum.LAST_EXECUTION}> |
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.
nit: this list should be a mapping expression using LibraryAgentSortEnum
…pping improvements
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 a new sorting option to order library agents by their last execution time instead of the last modified time.
- Added LAST_EXECUTION to the LibraryAgentSortEnum in frontend and backend.
- Updated the dropdown in the library sort menu to include a "Last Run" option.
- Adjusted the API request logic in the backend to support sorting agents by their last execution time.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts | Added LAST_EXECUTION to the LibraryAgentSortEnum. |
autogpt_platform/frontend/src/components/library/library-sort-menu.tsx | Updated dropdown options in the sort menu to include a new "Last Run" label and use a memoized placeholder. |
autogpt_platform/frontend/src/app/(platform)/library/state-provider.tsx | Changed the default sort behavior to LAST_EXECUTION. |
autogpt_platform/backend/backend/server/v2/library/model.py | Added LAST_EXECUTION to the backend LibraryAgentSort enum. |
autogpt_platform/backend/backend/server/v2/library/db.py | Modified the order_by logic to support backend sorting by lastExecution with a fallback to updatedAt. |
…ring in agent sorting
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.
After the changes made, I'm happy. Now you just have to convince the CI. :)
@Pwuts Thankyou , I will work on it |
Changes 🏗️
This PR implements a new sorting option in the Library view to order agents by their last execution time rather than last edit time. This addresses a common user need to quickly access recently run agents, regardless of how they were executed (via GUI or otherwise).
-->Added LAST_EXECUTION to LibraryAgentSortEnum in types.ts
-->Updated the dropdown in library-sort-menu.tsx to include a "Last Run" option
-->Modified the placeholder text based on the selected sort option
-->Changed the default sort behavior in state-provider.tsx to LAST_EXECUTION
-->Adjusted API request logic to pass lastExecution as the sort key, enabling backend-side sorting by run time
-->Ensured sorting accounts for all executions (manual and automatic)
#9860