feat(api/core/app/segments/parser.py): Remove blank segment in convert_template (#6709)

Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
-LAN-
2024-07-26 18:19:33 +08:00
committed by GitHub
parent e4542215cc
commit 5d77dc4f58
2 changed files with 3 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ VARIABLE_PATTERN = re.compile(r'\{\{#([a-zA-Z0-9_]{1,50}(?:\.[a-zA-Z_][a-zA-Z0-9
def convert_template(*, template: str, variable_pool: VariablePool):
parts = re.split(VARIABLE_PATTERN, template)
segments = []
for part in parts:
for part in filter(lambda x: x, parts):
if '.' in part and (value := variable_pool.get(part.split('.'))):
segments.append(value)
else: