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) : Optional number input (#8940)

Abhimanyu Yadavb8a3ffc04a33
diff --git a/autogpt_platform/frontend/src/components/node-input-components.tsx b/autogpt_platform/frontend/src/components/node-input-components.tsx
index da84699d06..cc72baa43d 100644
--- a/autogpt_platform/frontend/src/components/node-input-components.tsx
+++ b/autogpt_platform/frontend/src/components/node-input-components.tsx
@@ -308,6 +308,21 @@ export const NodeGenericInputField: FC<{
handleInputClick={handleInputClick}
/>
);
+ } else if (
+ (types.includes("integer") || types.includes("number")) &&
+ types.includes("null")
+ ) {
+ return (
+ <NodeNumberInput
+ selfKey={propKey}
+ schema={{ ...propSchema, type: "integer" } as BlockIONumberSubSchema}
+ value={currentValue}
+ error={errors[propKey]}
+ className={className}
+ displayName={displayName}
+ handleInputChange={handleInputChange}
+ />
+ );
}
}
@@ -541,7 +556,7 @@ const NodeKeyValueInput: FC<{
>
<div>
{keyValuePairs.map(({ key, value }, index) => (
- /*
+ /*
The `index` is used as a DOM key instead of the actual `key`
because the `key` can change with each input, causing the input to lose focus.
*/