Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(market): Handle empty agents response (#8393)

Abhimanyu Yadavf3a4fd2a4165
diff --git a/autogpt_platform/frontend/src/app/marketplace/page.tsx b/autogpt_platform/frontend/src/app/marketplace/page.tsx
index 232f94c96d..7fc67c95ae 100644
--- a/autogpt_platform/frontend/src/app/marketplace/page.tsx
+++ b/autogpt_platform/frontend/src/app/marketplace/page.tsx
@@ -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">
@@ -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}
diff --git a/autogpt_platform/market/.env.example b/autogpt_platform/market/.env.example
index 5522998fc1..b3b1cb8a4e 100644
--- a/autogpt_platform/market/.env.example
+++ b/autogpt_platform/market/.env.example
@@ -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
\ No newline at end of file
+APP_ENV=local