# Copyright (c) 2025 Patrick Motsch # File node definitions - create files from context (e.g. from AI nodes). from modules.shared.i18nRegistry import t from modules.features.graphicalEditor.nodeDefinitions.contextPickerHelp import ( CONTEXT_BUILDER_PARAM_DESCRIPTION, ) from modules.features.graphicalEditor.nodeDefinitions.ai import DOCUMENT_LIST_DATA_PICK_OPTIONS FILE_NODES = [ { "id": "file.create", "category": "file", "label": t("Datei erstellen"), "description": t( "Erstellt eine Datei aus Kontext. Nach „Inhalt extrahieren“: „response“ für reinen Text; " "„Nur Bilder“ liefert alle extrahierten Bilder — Datei erstellen fasst sie zu einer PDF oder DOCX " "(Ausgabeformat pdf oder docx wählen)." ), "parameters": [ {"name": "outputFormat", "type": "str", "required": True, "frontendType": "select", "frontendOptions": {"options": ["docx", "pdf", "txt", "html", "md"]}, "description": t("Ausgabeformat"), "default": "docx"}, {"name": "title", "type": "str", "required": False, "frontendType": "text", "description": t("Dokumenttitel")}, {"name": "folderId", "type": "str", "required": False, "frontendType": "userFileFolder", "description": t("Zielordner in Meine Dateien"), "default": ""}, {"name": "context", "type": "Any", "required": False, "frontendType": "contextBuilder", "description": CONTEXT_BUILDER_PARAM_DESCRIPTION, "default": "", "graphInherit": {"port": 0, "kind": "primaryTextRef"}}, ], "inputs": 1, "outputs": 1, "inputPorts": {0: {"accepts": ["AiResult", "TextResult", "Transit", "FormPayload", "LoopItem", "ActionResult"]}}, "outputPorts": {0: {"schema": "DocumentList", "dataPickOptions": DOCUMENT_LIST_DATA_PICK_OPTIONS}}, "meta": {"icon": "mdi-file-plus-outline", "color": "#2196F3", "usesAi": False}, "_method": "file", "_action": "create", }, ]