Skip to content

Commit

Permalink
fix(market): Handle empty agents response (#8393)
Browse files Browse the repository at this point in the history
* Fix issue where marketplace breaks if no agents are returned

* Fix issue where marketplace breaks if no agents are returned

* Remove supabase folder from tracking

* adding supabase submodule

---------

Co-authored-by: Aarushi <[email protected]>
  • Loading branch information
Abhi1992002 and aarushik93 authored Oct 24, 2024
1 parent 643c334 commit f3a4fd2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 16 additions & 3 deletions autogpt_platform/frontend/src/app/marketplace/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const AgentCard: React.FC<{ agent: Agent; featured?: boolean }> = ({
{agent.description}
</p>
<div className="mb-2 text-xs text-gray-400">
Categories: {agent.categories.join(", ")}
Categories: {agent.categories?.join(", ")}
</div>
</div>
<div className="flex items-end justify-between">
Expand Down Expand Up @@ -315,14 +315,27 @@ const Marketplace: React.FC = () => {
)
) : (
<>
{featuredAgents.length > 0 && (
{featuredAgents?.length > 0 ? (
<AgentGrid
agents={featuredAgents}
title="Featured Agents"
featured={true}
/>
) : (
<div className="py-12 text-center">
<p className="text-gray-600">No Featured Agents found</p>
</div>
)}

<hr />

{topAgents?.length > 0 ? (
<AgentGrid agents={topAgents} title="Top Downloaded Agents" />
) : (
<div className="py-12 text-center">
<p className="text-gray-600">No Top Downloaded Agents found</p>
</div>
)}
<AgentGrid agents={topAgents} title="Top Downloaded Agents" />
<Pagination
page={topAgentsPage}
totalPages={topAgentsTotalPages}
Expand Down
2 changes: 1 addition & 1 deletion autogpt_platform/market/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ ENABLE_AUTH=true
SUPABASE_JWT_SECRET=our-super-secret-jwt-token-with-at-least-32-characters-long
BACKEND_CORS_ALLOW_ORIGINS="http://localhost:3000,http://127.0.0.1:3000"

APP_ENV=local
APP_ENV=local

0 comments on commit f3a4fd2

Please sign in to comment.