🐛 fix(validate.py): remove unused template fields from frontend_node
The code now removes any unused template fields from the frontend_node to avoid any potential errors.
This commit is contained in:
parent
aee34c87f2
commit
2cf16de113
1 changed files with 3 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue