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): Add support to optional multiselect (#9885)
Abhimanyu Yadav5b5b2043e808
diff --git a/autogpt_platform/frontend/src/components/node-input-components.tsx b/autogpt_platform/frontend/src/components/node-input-components.tsxindex 7c705fb8e6..71b2ab2de4 100644--- a/autogpt_platform/frontend/src/components/node-input-components.tsx+++ b/autogpt_platform/frontend/src/components/node-input-components.tsx@@ -429,9 +429,9 @@ export const NodeGenericInputField: FC<{// If you want to build an object of booleans from `selection`// (like your old code), do it here. Otherwise adapt to your actual UI.// Example:- const allKeys = schema.properties- ? Object.keys(schema.properties)- : [];+ const subSchema =+ schema.properties || (schema as any).anyOf[0].properties;+ const allKeys = subSchema ? Object.keys(subSchema) : [];handleInputChange(key,Object.fromEntries(@@ -1025,7 +1025,12 @@ const NodeMultiSelectInput: FC<{displayName,handleInputChange,}) => {- const options = Object.keys(schema.properties);+ const optionSchema =+ schema.properties ||+ ((schema as any).anyOf?.length > 0+ ? (schema as any).anyOf[0].properties+ : {});+ const options = Object.keys(optionSchema);return (<div className={cn("flex flex-col", className)}>@@ -1044,7 +1049,7 @@ const NodeMultiSelectInput: FC<{<MultiSelectorContent className="nowheel"><MultiSelectorList>{options- .map((key) => ({ ...schema.properties[key], key }))+ .map((key) => ({ ...optionSchema[key], key })).map(({ key, title, description }) => (<MultiSelectorItem key={key} value={key} title={description}>{title ?? key}