工作流步骤

开关

type: "switch"

几个分支。 一个值、 案例列表和默认值—— 每个分支都有边际 。

freecases requireddefault always exists
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

valueany

测试什么。 通常是一个模板 。

casesarray必填

[{ key, operator, value }]至少一个

{ id: "route", type: "switch", config: {
    value: "{{steps.classify.output.kind}}",
    cases: [
      { key: "billing", operator: "eq", value: "billing" },
      { key: "bug",     operator: "eq", value: "bug" },
    ],
} }

edges: [
  { from: "route", to: "to_finance", branch: "billing" },
  { from: "route", to: "to_support", branch: "bug" },
  { from: "route", to: "to_inbox",   branch: "default" },
]
{"id": "route", "type": "switch", "config": {
    "value": "{{steps.classify.output.kind}}",
    "cases": [
        {"key": "billing", "operator": "eq", "value": "billing"},
        {"key": "bug", "operator": "eq", "value": "bug"},
    ],
}}

edges = [
    {"from": "route", "to": "to_finance", "branch": "billing"},
    {"from": "route", "to": "to_support", "branch": "bug"},
    {"from": "route", "to": "to_inbox", "branch": "default"},
]

案案关键

字母,字母,数字, _ 或 -可能不是 next, true, false 或 default并且他们可能不再重复——所有四个人都被拒发,因为每一个人都会把问题弄得模糊不清。

默认非可选

每个案件都需要边缘, 违约也一样

匹配无值的值会默认。 没有这一边, 运行就会结束, 没有单词, 条件也会同时需要两个分支 。

输出

{{steps.route.output.branch}}   // the case key taken, or "default"
{{steps.route.output.value}}
"{{steps.route.output.branch}}"   # the case key taken, or "default"
"{{steps.route.output.value}}"

第一个匹配的胜案

他们被按顺序审判,所以先把具体的案件放在第一位。