161 lines
7 KiB
Python
161 lines
7 KiB
Python
# Copyright (c) 2025 Patrick Motsch
|
|
# AI node definitions - map to methodAi actions.
|
|
|
|
from modules.shared.i18nRegistry import t
|
|
|
|
AI_NODES = [
|
|
{
|
|
"id": "ai.prompt",
|
|
"category": "ai",
|
|
"label": t("Prompt"),
|
|
"description": t("Prompt eingeben und KI führt aus"),
|
|
"parameters": [
|
|
{"name": "aiPrompt", "type": "string", "required": True, "frontendType": "textarea",
|
|
"description": t("KI-Prompt")},
|
|
{"name": "outputFormat", "type": "string", "required": False, "frontendType": "select",
|
|
"frontendOptions": {"options": ["text", "json", "emailDraft"]},
|
|
"description": t("Ausgabeformat"), "default": "text"},
|
|
{"name": "documentList", "type": "string", "required": False, "frontendType": "hidden",
|
|
"description": t("Dokumentenliste (via Wire oder DataRef)"), "default": ""},
|
|
{"name": "context", "type": "string", "required": False, "frontendType": "hidden",
|
|
"description": t("Kontext-Daten (via Wire oder DataRef)"), "default": ""},
|
|
{"name": "simpleMode", "type": "boolean", "required": False, "frontendType": "checkbox",
|
|
"description": t("Einfacher Modus"), "default": True},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": ["DocumentList", "AiResult", "TextResult", "Transit"]}},
|
|
"outputPorts": {0: {"schema": "AiResult"}},
|
|
"meta": {"icon": "mdi-robot", "color": "#9C27B0", "usesAi": True},
|
|
"_method": "ai",
|
|
"_action": "process",
|
|
},
|
|
{
|
|
"id": "ai.webResearch",
|
|
"category": "ai",
|
|
"label": t("Web-Recherche"),
|
|
"description": t("Recherche im Web"),
|
|
"parameters": [
|
|
{"name": "prompt", "type": "string", "required": True, "frontendType": "textarea",
|
|
"description": t("Recherche-Anfrage")},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": ["Transit"]}},
|
|
"outputPorts": {0: {"schema": "AiResult"}},
|
|
"meta": {"icon": "mdi-magnify", "color": "#9C27B0", "usesAi": True},
|
|
"_method": "ai",
|
|
"_action": "webResearch",
|
|
},
|
|
{
|
|
"id": "ai.summarizeDocument",
|
|
"category": "ai",
|
|
"label": t("Dokument zusammenfassen"),
|
|
"description": t("Dokumentinhalt zusammenfassen"),
|
|
"parameters": [
|
|
{"name": "summaryLength", "type": "string", "required": False, "frontendType": "select",
|
|
"frontendOptions": {"options": ["short", "medium", "long"]},
|
|
"description": t("Kurz, mittel oder lang"), "default": "medium"},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": ["DocumentList", "Transit"]}},
|
|
"outputPorts": {0: {"schema": "AiResult"}},
|
|
"meta": {"icon": "mdi-file-document-outline", "color": "#9C27B0", "usesAi": True},
|
|
"_method": "ai",
|
|
"_action": "summarizeDocument",
|
|
},
|
|
{
|
|
"id": "ai.translateDocument",
|
|
"category": "ai",
|
|
"label": t("Dokument übersetzen"),
|
|
"description": t("Dokument in Zielsprache übersetzen"),
|
|
"parameters": [
|
|
{"name": "targetLanguage", "type": "string", "required": True, "frontendType": "select",
|
|
"frontendOptions": {"options": ["en", "de", "fr", "it", "es", "pt", "nl"]},
|
|
"description": t("Zielsprache")},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": ["DocumentList", "Transit"]}},
|
|
"outputPorts": {0: {"schema": "AiResult"}},
|
|
"meta": {"icon": "mdi-translate", "color": "#9C27B0", "usesAi": True},
|
|
"_method": "ai",
|
|
"_action": "translateDocument",
|
|
},
|
|
{
|
|
"id": "ai.convertDocument",
|
|
"category": "ai",
|
|
"label": t("Dokument konvertieren"),
|
|
"description": t("Dokument in anderes Format konvertieren"),
|
|
"parameters": [
|
|
{"name": "targetFormat", "type": "string", "required": True, "frontendType": "select",
|
|
"frontendOptions": {"options": ["pdf", "docx", "txt", "html", "md"]},
|
|
"description": t("Zielformat")},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": ["DocumentList", "Transit"]}},
|
|
"outputPorts": {0: {"schema": "DocumentList"}},
|
|
"meta": {"icon": "mdi-file-convert", "color": "#9C27B0", "usesAi": True},
|
|
"_method": "ai",
|
|
"_action": "convertDocument",
|
|
},
|
|
{
|
|
"id": "ai.generateDocument",
|
|
"category": "ai",
|
|
"label": t("Dokument generieren"),
|
|
"description": t("Dokument aus Prompt generieren"),
|
|
"parameters": [
|
|
{"name": "prompt", "type": "string", "required": True, "frontendType": "textarea",
|
|
"description": t("Generierungs-Prompt")},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": ["Transit"]}},
|
|
"outputPorts": {0: {"schema": "DocumentList"}},
|
|
"meta": {"icon": "mdi-file-plus", "color": "#9C27B0", "usesAi": True},
|
|
"_method": "ai",
|
|
"_action": "generateDocument",
|
|
},
|
|
{
|
|
"id": "ai.generateCode",
|
|
"category": "ai",
|
|
"label": t("Code generieren"),
|
|
"description": t("Code aus Beschreibung generieren"),
|
|
"parameters": [
|
|
{"name": "prompt", "type": "string", "required": True, "frontendType": "textarea",
|
|
"description": t("Code-Generierungs-Prompt")},
|
|
{"name": "language", "type": "string", "required": False, "frontendType": "select",
|
|
"frontendOptions": {"options": ["python", "javascript", "typescript", "java", "csharp", "go"]},
|
|
"description": t("Programmiersprache"), "default": "python"},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": ["Transit"]}},
|
|
"outputPorts": {0: {"schema": "AiResult"}},
|
|
"meta": {"icon": "mdi-code-tags", "color": "#9C27B0", "usesAi": True},
|
|
"_method": "ai",
|
|
"_action": "generateCode",
|
|
},
|
|
{
|
|
"id": "ai.consolidate",
|
|
"category": "ai",
|
|
"label": t("KI-Konsolidierung"),
|
|
"description": t("Gesammelte Ergebnisse mit KI zusammenfassen, klassifizieren oder semantisch zusammenführen"),
|
|
"parameters": [
|
|
{"name": "mode", "type": "string", "required": False, "frontendType": "select",
|
|
"frontendOptions": {"options": ["summarize", "classify", "semanticMerge"]},
|
|
"description": t("Konsolidierungsmodus"), "default": "summarize"},
|
|
{"name": "prompt", "type": "string", "required": False, "frontendType": "textarea",
|
|
"description": t("Optionaler Prompt für die Konsolidierung"), "default": ""},
|
|
],
|
|
"inputs": 1,
|
|
"outputs": 1,
|
|
"inputPorts": {0: {"accepts": ["AggregateResult", "Transit"]}},
|
|
"outputPorts": {0: {"schema": "ConsolidateResult"}},
|
|
"meta": {"icon": "mdi-table-merge-cells", "color": "#9C27B0", "usesAi": True},
|
|
"_method": "ai",
|
|
"_action": "consolidate",
|
|
},
|
|
]
|