Skip to content
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

fix(market): agent pagination and search errors #8336

Merged
merged 8 commits into from
Oct 16, 2024

Conversation

ntindle
Copy link
Member

@ntindle ntindle commented Oct 14, 2024

Background

Search and pagination are currently broken for the marketplace due to issues with the responses not being clear on what needs to be paginated. Additionally, a migration was missed, so it is being re-added here, and the fixes are associated so the code passes lint.

Changes 🏗️

  • Generalizes the pagination wrapper
    • this moves a lot of things from .agents, .analytics, .agent etc to .items
    • There is the one left for the /agent endpoint because it is unused and non-functional
  • separates the search pagination from the top agents' pagination
  • sets the default category filter to 1=1 where used always to insert a valid SQL query
  • does additional logic around when we search short terms and are unable to rank them
  • correctly count total responses in used queries, rather than returning the count of items in a response, which is useless for pagination
  • return paginated items where required rather than lists of items
  • non-testing (the tests fail and are out of date generated) CI added to prevent linting errors again in the future

Testing 🔍

Note

Only for the new autogpt platform, currently in autogpt_platform/

  • Create from scratch and execute an agent with at least 3 blocks
  • Import an agent from file upload, and confirm it executes correctly
  • Upload agent to marketplace
  • Import an agent from marketplace and confirm it executes correctly
  • Edit an agent from monitor, and confirm it executes correctly

@ntindle ntindle requested a review from a team as a code owner October 14, 2024 17:02
@ntindle ntindle requested review from Pwuts and Bentlybro and removed request for a team October 14, 2024 17:02
@github-actions github-actions bot added platform/frontend AutoGPT Platform - Front end platform/backend AutoGPT Platform - Back end size/l labels Oct 14, 2024
Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Performance Concern
The search query in the search_db function might be inefficient for large datasets. Consider optimizing the query or implementing caching mechanisms.

Potential Bug
The get_top_agents_by_downloads function performs two separate database queries, which could lead to inconsistent results if the data changes between queries.

Code Smell
The Marketplace component has become quite complex with multiple state variables and useEffect hooks. Consider refactoring this component to improve readability and maintainability.

@ntindle ntindle requested a review from a team as a code owner October 14, 2024 19:04
@ntindle ntindle enabled auto-merge (squash) October 16, 2024 20:21
@ntindle ntindle merged commit d6d2820 into dev Oct 16, 2024
9 checks passed
@ntindle ntindle deleted the fix/marketplace-pagination-and-search branch October 16, 2024 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/backend AutoGPT Platform - Back end platform/frontend AutoGPT Platform - Front end Review effort [1-5]: 4 size/l
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants