🐛 fix(validate.py): set new field value with the old value if variable already exists in the template
The code now checks if the variable already exists in the template and if so, sets the new field value with the old value. This ensures that the existing value is preserved when adding new variables to the template.
This commit is contained in:
parent
244aeae916
commit
5445adbbce
1 changed files with 5 additions and 1 deletions
|
|
@ -74,7 +74,11 @@ def add_new_variables_to_template(input_variables, prompt_request):
|
|||
multiline=True,
|
||||
input_types=["Document", "BaseOutputParser"],
|
||||
)
|
||||
|
||||
if variable in prompt_request.frontend_node.template:
|
||||
# Set the new field with the old value
|
||||
template_field.value = prompt_request.frontend_node.template[variable][
|
||||
"value"
|
||||
]
|
||||
prompt_request.frontend_node.template[variable] = template_field.to_dict()
|
||||
|
||||
# Check if variable is not already in the list before appending
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue