From 73dee84caba9b72e54b8dd4d2d3b449d709124ef Mon Sep 17 00:00:00 2001 From: Yeuoly <45712896+Yeuoly@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:38:13 +0800 Subject: [PATCH] fix: add handling for non-string type in variable template parser (#4996) --- api/core/workflow/utils/variable_template_parser.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/core/workflow/utils/variable_template_parser.py b/api/core/workflow/utils/variable_template_parser.py index 23b8ce2974..9c1dc6086a 100644 --- a/api/core/workflow/utils/variable_template_parser.py +++ b/api/core/workflow/utils/variable_template_parser.py @@ -45,7 +45,11 @@ class VariableTemplateParser: def replacer(match): key = match.group(1) value = inputs.get(key, match.group(0)) # return original matched string if key not found - + # convert the value to string + if isinstance(value, list | dict | bool | int | float): + value = str(value) + + # remove template variables if required if remove_template_variables: return VariableTemplateParser.remove_template_variables(value) return value