From f117d3fe1637d0620c76697a2d328c8d001c378f Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Mon, 21 Oct 2024 12:38:37 +0200 Subject: [PATCH] hide `payload` input --- autogpt_platform/backend/backend/blocks/github/triggers.py | 2 +- autogpt_platform/backend/backend/data/model.py | 2 ++ autogpt_platform/frontend/src/components/CustomNode.tsx | 2 ++ autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/autogpt_platform/backend/backend/blocks/github/triggers.py b/autogpt_platform/backend/backend/blocks/github/triggers.py index 421bc9b08ac3..c6943e268b25 100644 --- a/autogpt_platform/backend/backend/blocks/github/triggers.py +++ b/autogpt_platform/backend/backend/blocks/github/triggers.py @@ -28,7 +28,7 @@ class Input(BlockSchema): description="Repository to subscribe to", placeholder="{owner}/{repo}", ) - payload: dict = SchemaField(description="Webhook payload", exclude=True) + payload: dict = SchemaField(hidden=True) class Output(BlockSchema): event: str = SchemaField(description="The event that triggered the webhook") diff --git a/autogpt_platform/backend/backend/data/model.py b/autogpt_platform/backend/backend/data/model.py index 0ca9d699c121..4fccdf8d7b78 100644 --- a/autogpt_platform/backend/backend/data/model.py +++ b/autogpt_platform/backend/backend/data/model.py @@ -113,6 +113,7 @@ def SchemaField( advanced: Optional[bool] = None, secret: bool = False, exclude: bool = False, + hidden: Optional[bool] = None, **kwargs, ) -> T: json_extra = { @@ -121,6 +122,7 @@ def SchemaField( "placeholder": placeholder, "secret": secret, "advanced": advanced, + "hidden": hidden, }.items() if v is not None } diff --git a/autogpt_platform/frontend/src/components/CustomNode.tsx b/autogpt_platform/frontend/src/components/CustomNode.tsx index 45c97a90c0ba..d3faf8db849e 100644 --- a/autogpt_platform/frontend/src/components/CustomNode.tsx +++ b/autogpt_platform/frontend/src/components/CustomNode.tsx @@ -185,6 +185,7 @@ export function CustomNode({ return keys.map(([propKey, propSchema]) => { const isRequired = data.inputSchema.required?.includes(propKey); const isAdvanced = propSchema.advanced; + const isHidden = propSchema.hidden; const isConnectable = // No input connection handles on INPUT and WEBHOOK blocks ![BlockUIType.INPUT, BlockUIType.WEBHOOK].includes(nodeType) && @@ -194,6 +195,7 @@ export function CustomNode({ !(nodeType == BlockUIType.OUTPUT && propKey == "value"); const isConnected = isInputHandleConnected(propKey); return ( + !isHidden && (isRequired || isAdvancedOpen || isConnected || !isAdvanced) && (
{isConnectable ? ( diff --git a/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts b/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts index f4e0d8751e43..709dbc289a98 100644 --- a/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts +++ b/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts @@ -54,6 +54,7 @@ export type BlockIOSubSchemaMeta = { description?: string; placeholder?: string; advanced?: boolean; + hidden?: boolean; }; export type BlockIOObjectSubSchema = BlockIOSubSchemaMeta & {