8
n8n 中文网amn8n.com

风险分析工作流

中级

这是一个Engineering, AI Summarization领域的自动化工作流,包含 8 个节点。主要使用 ConvertToFile, ManualTrigger, ReadWriteFile, Agent, ExtractFromFile 等节点。 基于GPT-4的ISO 26262合规性自动化危害分析

前置要求
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "Z59iv0jcVPieE4iB",
  "meta": {
    "instanceId": "e23a10c38a84aff056a546290ab44e4d0883223400a2378b1f2a9dd2f5a8af2a",
    "templateCredsSetupCompleted": true
  },
  "name": "风险分析工作流",
  "tags": [],
  "nodes": [
    {
      "id": "c21a3f97-2516-4503-82f8-f4db5ff0d340",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        380,
        -100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f75201fe-b2e7-47ee-81b9-569c59e24ea8",
      "name": "AI 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        940,
        -100
      ],
      "parameters": {
        "text": "=const description = {{ $json.data }}.binary.data.toString('utf-8');\\nconst prompt = `Analyze this system for hazards:\\n${description}\\n\\nOutput:\\n1. 5 potential hazards\\n2. Likely root causes\\n3. ISO 26262 relevant clauses`;\\nreturn [{ json: { prompt } }];",
        "options": {
          "systemMessage": "You are a helpful assistant"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "dd6e7cd7-a710-4aec-88d7-3ff721c0343e",
      "name": "AI_风险分析",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        800,
        200
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "vrJ0hwKixLk44aS4",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2336bc58-23b7-4e07-a851-3cc641383f5e",
      "name": "一个简单的记忆窗口",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1020,
        180
      ],
      "parameters": {
        "sessionKey": "={{ $execution.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "6de497e1-78de-4718-b822-e6c11b2a7fee",
      "name": "读取系统描述",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        580,
        -100
      ],
      "parameters": {
        "options": {},
        "fileSelector": "/data/inputs/1_hazard_identification/systems_description.txt"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "b3bdc41c-32f6-4844-9dde-10890d3ce23e",
      "name": "将输入转换为二进制数据",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        780,
        -100
      ],
      "parameters": {
        "options": {},
        "operation": "text"
      },
      "typeVersion": 1
    },
    {
      "id": "24fc87bb-32c5-4cd5-8a93-86d427ff9122",
      "name": "转换为文件",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1260,
        -100
      ],
      "parameters": {
        "options": {},
        "operation": "toText",
        "sourceProperty": "output"
      },
      "typeVersion": 1.1
    },
    {
      "id": "155b8ccd-fcbc-44dc-974c-8c2db909fd5e",
      "name": "潜在风险报告.txt",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        1480,
        -100
      ],
      "parameters": {
        "options": {
          "append": false
        },
        "fileName": "=/data/outputs/1_hazard_identification/Report_Hazard Identification.txt_{{ $now.toString() }}",
        "operation": "write"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "413fa66c-03e4-40b2-b4ae-4d4a081fd32e",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Potential_risks_report.txt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI_Hazard_Analysis": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "A simple memory window": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Read Systems_Description": {
      "main": [
        [
          {
            "node": "Convert input to binary data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert input to binary data": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Read Systems_Description",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 工程, AI 摘要总结

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量8
分类2
节点类型7
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流