From 2cf16de113e120e2fbb8b582839d3330dec97e4f Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 27 Jun 2023 19:51:18 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(validate.py):=20remove=20unu?= =?UTF-8?q?sed=20template=20fields=20from=20frontend=5Fnode=20The=20code?= =?UTF-8?q?=20now=20removes=20any=20unused=20template=20fields=20from=20th?= =?UTF-8?q?e=20frontend=5Fnode=20to=20avoid=20any=20potential=20errors.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/validate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/backend/langflow/api/v1/validate.py b/src/backend/langflow/api/v1/validate.py index fada9ce23..802ee3e3d 100644 --- a/src/backend/langflow/api/v1/validate.py +++ b/src/backend/langflow/api/v1/validate.py @@ -39,6 +39,9 @@ def post_validate_prompt(prompt: ValidatePromptRequest): prompt.frontend_node.template[variable] = template_field.to_dict() prompt.frontend_node.custom_fields.append(variable) + for key in prompt.frontend_node.template: + if key not in input_variables: + prompt.frontend_node.template.pop(key, None) except Exception as exc: logger.exception(exc) raise HTTPException(status_code=500, detail=str(exc)) from exc