feat(workflow): support retrieving variables wrapped in {{}} from variable pool

This commit is contained in:
mengyonghao
2026-01-05 10:52:46 +08:00
parent bf6ede64bd
commit fc831e04c1

View File

@@ -10,6 +10,7 @@
""" """
import logging import logging
import re
from typing import Any, TYPE_CHECKING from typing import Any, TYPE_CHECKING
if TYPE_CHECKING: if TYPE_CHECKING:
@@ -114,7 +115,9 @@ class VariablePool:
""" """
# 转换为 VariableSelector # 转换为 VariableSelector
if isinstance(selector, str): if isinstance(selector, str):
selector = VariableSelector.from_string(selector).path pattern = r"\{\{\s*(.*?)\s*\}\}"
variable_literal = re.sub(pattern, r"\1", selector).strip()
selector = VariableSelector.from_string(variable_literal).path
if not selector or len(selector) < 1: if not selector or len(selector) < 1:
raise ValueError("变量选择器不能为空") raise ValueError("变量选择器不能为空")