feat(research): streamline template details and enable bot versioning
Deploy production / deploy (push) Successful in 1m35s
Deploy production / deploy (push) Successful in 1m35s
This commit is contained in:
@@ -148,16 +148,25 @@ class Experiments:
|
||||
)
|
||||
variables = {}
|
||||
for name, variable in template.variables.items():
|
||||
values = variable.values
|
||||
# Empty field definitions bind only to the selected immutable input scope.
|
||||
# Existing explicit domains remain restrictions and are never silently widened.
|
||||
if variable.kind == "field":
|
||||
for value in variable.values:
|
||||
if not values:
|
||||
values = sorted(field for field, kind in fields.items() if kind == variable.field_type)
|
||||
if not values:
|
||||
raise HTTPException(422, f"变量 {name} 没有匹配的 {variable.field_type} 字段,请调整数据准备")
|
||||
for value in values:
|
||||
if fields.get(str(value)) != variable.field_type:
|
||||
raise HTTPException(422, f"变量 {name} 的字段 {value} 不在固定输入中或类型不符")
|
||||
if variable.kind == "group" and any(
|
||||
str(v) not in GROUPS and fields.get(str(v)) != "GROUP" for v in variable.values
|
||||
):
|
||||
raise HTTPException(422, f"分组变量 {name} 未在固定输入中核实")
|
||||
if not values:
|
||||
raise HTTPException(422, f"变量 {name} 缺少候选取值,请通过模板接口补充,或将固定参数直接写入表达式")
|
||||
variables[name] = [
|
||||
json.dumps(v, ensure_ascii=False) if variable.kind == "string" else v for v in variable.values
|
||||
json.dumps(v, ensure_ascii=False) if variable.kind == "string" else v for v in values
|
||||
]
|
||||
try:
|
||||
expanded = expand(template.expression, variables, body.mode, body.limit, body.seed)
|
||||
|
||||
Reference in New Issue
Block a user