mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(frontend): Add support to optional multiselect (#9885)
- fix #9882 we’re currently using optional multi select, and it’s working great. We’re able to correctly determine the data type for it. However, there’s a small issue. We’re not using the correct subSchema that is inside anyOf on the multi select input. This is why we’re getting the problem on the Twitter block. It’s the only one that’s using this type of input, so it’s the only one that’s affected.  --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user