75 lines
3.2 KiB
Python
75 lines
3.2 KiB
Python
# Copyright (c) 2025 Patrick Motsch
|
|
# Context node definitions — structural extraction without AI.
|
|
|
|
from modules.shared.i18nRegistry import t
|
|
|
|
CONTEXT_NODES = [
|
|
{
|
|
"id": "context.extractContent",
|
|
"category": "context",
|
|
"label": t("Inhalt extrahieren"),
|
|
"description": t(
|
|
"Extrahiert Inhalt ohne KI. Ergebnis einheitlich wie KI-Schritte: `response` "
|
|
"(gesammelter Klartext), strukturierte JSON-Unterlage in `documents[0]`, "
|
|
"einzelne Bilder als eigene Dokumente `extract_media_*` (nur im Workflow, ohne Eintrag unter „Meine Dateien“) — "
|
|
"Auswahl im Daten-Picker wie bei `ai.process`."
|
|
),
|
|
"parameters": [
|
|
{"name": "documentList", "type": "str", "required": True, "frontendType": "hidden",
|
|
"description": t("Dokumentenliste (via Wire oder DataRef)"), "default": "",
|
|
"graphInherit": {"port": 0, "kind": "documentListWire"}},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": ["DocumentList", "Transit", "LoopItem"]}},
|
|
"outputPorts": {
|
|
0: {
|
|
"schema": "ActionResult",
|
|
# Authoritative DataPicker paths (same idea as ``parameters`` for configuration).
|
|
# Frontend uses only this list — no schema expansion merge for this port.
|
|
"dataPickOptions": [
|
|
{
|
|
"path": ["documents", 0, "documentData"],
|
|
"pickerLabel": t("Gesamter Inhalt"),
|
|
"detail": t(
|
|
"Strukturiertes Handover als JSON inklusive aller Textteile "
|
|
"und Verweisen auf ausgelagerte Bilder."
|
|
),
|
|
"recommended": True,
|
|
"type": "Any",
|
|
},
|
|
{
|
|
"path": ["response"],
|
|
"pickerLabel": t("Nur Text"),
|
|
"detail": t(
|
|
"Verketteter Klartext aus allen erkannten Textteilen."
|
|
),
|
|
"recommended": True,
|
|
"type": "str",
|
|
},
|
|
{
|
|
"path": ["imageDocumentsOnly"],
|
|
"pickerLabel": t("Nur Bilder"),
|
|
"detail": t(
|
|
"Nur die extrahierten Bilddokumente als Liste, ohne JSON-Handover."
|
|
),
|
|
"recommended": False,
|
|
"type": "List[ActionDocument]",
|
|
},
|
|
{
|
|
"path": ["documents"],
|
|
"pickerLabel": t("Alle Dateitypen"),
|
|
"detail": t(
|
|
"Alle Ausgabedokumente nacheinander: JSON-Handover und Bilder."
|
|
),
|
|
"recommended": False,
|
|
"type": "List[ActionDocument]",
|
|
},
|
|
],
|
|
}
|
|
},
|
|
"meta": {"icon": "mdi-file-tree-outline", "color": "#00897B", "usesAi": False},
|
|
"_method": "context",
|
|
"_action": "extractContent",
|
|
},
|
|
]
|