130 lines
4.4 KiB
Python
130 lines
4.4 KiB
Python
# Copyright (c) 2025 Patrick Motsch
|
|
# Flow control node definitions.
|
|
|
|
from modules.shared.i18nRegistry import t
|
|
|
|
FLOW_NODES = [
|
|
{
|
|
"id": "flow.ifElse",
|
|
"category": "flow",
|
|
"label": t("Wenn / Sonst"),
|
|
"description": t("Verzweigung nach Bedingung"),
|
|
"parameters": [
|
|
{
|
|
"name": "condition",
|
|
"type": "string",
|
|
"required": True,
|
|
"frontendType": "condition",
|
|
"description": t("Bedingung"),
|
|
},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 2,
|
|
"outputLabels": [t("Ja"), t("Nein")],
|
|
"inputPorts": {0: {"accepts": ["Transit"]}},
|
|
"outputPorts": {0: {"schema": "Transit"}, 1: {"schema": "Transit"}},
|
|
"executor": "flow",
|
|
"meta": {"icon": "mdi-source-branch", "color": "#FF9800", "usesAi": False},
|
|
},
|
|
{
|
|
"id": "flow.switch",
|
|
"category": "flow",
|
|
"label": t("Switch"),
|
|
"description": t("Mehrere Zweige nach Wert"),
|
|
"parameters": [
|
|
{
|
|
"name": "value",
|
|
"type": "string",
|
|
"required": True,
|
|
"frontendType": "text",
|
|
"description": t("Zu vergleichender Wert"),
|
|
},
|
|
{
|
|
"name": "cases",
|
|
"type": "array",
|
|
"required": False,
|
|
"frontendType": "caseList",
|
|
"description": t("Fälle"),
|
|
},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": ["Transit"]}},
|
|
"outputPorts": {0: {"schema": "Transit"}},
|
|
"executor": "flow",
|
|
"meta": {"icon": "mdi-swap-horizontal", "color": "#FF9800", "usesAi": False},
|
|
},
|
|
{
|
|
"id": "flow.loop",
|
|
"category": "flow",
|
|
"label": t("Schleife / Für Jedes"),
|
|
"description": t("Über Array-Elemente oder UDM-Strukturebenen iterieren"),
|
|
"parameters": [
|
|
{
|
|
"name": "items",
|
|
"type": "string",
|
|
"required": True,
|
|
"frontendType": "text",
|
|
"description": t("Pfad zum Array"),
|
|
},
|
|
{
|
|
"name": "level",
|
|
"type": "string",
|
|
"required": False,
|
|
"frontendType": "select",
|
|
"frontendOptions": {"options": ["auto", "documents", "structuralNodes", "contentBlocks"]},
|
|
"description": t("UDM-Iterationsebene"),
|
|
"default": "auto",
|
|
},
|
|
{
|
|
"name": "concurrency",
|
|
"type": "number",
|
|
"required": False,
|
|
"frontendType": "number",
|
|
"frontendOptions": {"min": 1, "max": 20},
|
|
"description": t("Parallele Iterationen (1 = sequentiell)"),
|
|
"default": 1,
|
|
},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": [
|
|
"Transit", "UdmDocument", "EmailList", "DocumentList", "FileList", "TaskList", "ActionResult",
|
|
]}},
|
|
"outputPorts": {0: {"schema": "LoopItem"}},
|
|
"executor": "flow",
|
|
"meta": {"icon": "mdi-repeat", "color": "#FF9800", "usesAi": False},
|
|
},
|
|
{
|
|
"id": "flow.merge",
|
|
"category": "flow",
|
|
"label": t("Zusammenführen"),
|
|
"description": t("Mehrere Zweige zusammenführen (2-5 Eingänge)"),
|
|
"parameters": [
|
|
{
|
|
"name": "mode",
|
|
"type": "string",
|
|
"required": False,
|
|
"frontendType": "select",
|
|
"frontendOptions": {"options": ["first", "all", "append"]},
|
|
"description": t("Zusammenführungsmodus"),
|
|
"default": "first",
|
|
},
|
|
{
|
|
"name": "inputCount",
|
|
"type": "number",
|
|
"required": False,
|
|
"frontendType": "number",
|
|
"frontendOptions": {"min": 2, "max": 5},
|
|
"description": t("Anzahl Eingänge"),
|
|
"default": 2,
|
|
},
|
|
],
|
|
"inputs": 2,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": ["Transit"]}, 1: {"accepts": ["Transit"]}},
|
|
"outputPorts": {0: {"schema": "MergeResult"}},
|
|
"executor": "flow",
|
|
"meta": {"icon": "mdi-call-merge", "color": "#FF9800", "usesAi": False},
|
|
},
|
|
]
|