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(frontend/marketplace): require category selection (#10031)

itsababseh3471781b982e
diff --git a/autogpt_platform/frontend/src/components/agptui/PublishAgentSelectInfo.tsx b/autogpt_platform/frontend/src/components/agptui/PublishAgentSelectInfo.tsx
index dff239c19a..4a64647487 100644
--- a/autogpt_platform/frontend/src/components/agptui/PublishAgentSelectInfo.tsx
+++ b/autogpt_platform/frontend/src/components/agptui/PublishAgentSelectInfo.tsx
@@ -159,9 +159,16 @@ export const PublishAgentInfo: React.FC<PublishAgentInfoProps> = ({
const handleSubmit = (e: React.MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
- onSubmit(title, subheader, slug, description, images, youtubeLink, [
- category,
- ]);
+ const categories = category ? [category] : [];
+ onSubmit(
+ title,
+ subheader,
+ slug,
+ description,
+ images,
+ youtubeLink,
+ categories,
+ );
};
return (
diff --git a/autogpt_platform/frontend/src/components/agptui/composite/PublishAgentPopout.tsx b/autogpt_platform/frontend/src/components/agptui/composite/PublishAgentPopout.tsx
index ff002f1e29..55fc8e6791 100644
--- a/autogpt_platform/frontend/src/components/agptui/composite/PublishAgentPopout.tsx
+++ b/autogpt_platform/frontend/src/components/agptui/composite/PublishAgentPopout.tsx
@@ -155,7 +155,7 @@ export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({
if (!subHeading) missingFields.push("Sub-heading");
if (!description) missingFields.push("Description");
if (!imageUrls.length) missingFields.push("Image");
- if (!categories.length) missingFields.push("Categories");
+ if (!categories.filter(Boolean).length) missingFields.push("Categories");
if (missingFields.length > 0) {
toast({
@@ -166,6 +166,7 @@ export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({
return;
}
+ const filteredCategories = categories.filter(Boolean);
setPublishData({
name,
sub_heading: subHeading,
@@ -175,7 +176,7 @@ export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({
agent_id: selectedAgentId || "",
agent_version: selectedAgentVersion || 0,
slug,
- categories,
+ categories: filteredCategories,
});
// Create store submission
@@ -189,7 +190,7 @@ export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({
agent_id: selectedAgentId || "",
agent_version: selectedAgentVersion || 0,
slug: slug.replace(/\s+/g, "-"),
- categories: categories,
+ categories: filteredCategories,
});
} catch (error) {
console.error("Error creating store submission:", error);