8
n8n 中文网amn8n.com

文本评分(子工作流)

中级

这是一个Market Research, AI Summarization领域的自动化工作流,包含 9 个节点。主要使用 Set, Merge, Aggregate, HttpRequest, ExecuteWorkflowTrigger 等节点。 使用Hugging Face Open Paws AI模型评估动物倡导文本

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "DTAMHkTadEbS2Xsv",
  "meta": {
    "instanceId": "26bd595441827fb23edb0643d6d240e79b0b8993d278e90950f16e18bf9e3c4a"
  },
  "name": "文本评分(子工作流)",
  "tags": [],
  "nodes": [
    {
      "id": "a81f2018-ff9d-473e-80d3-c0305b297a58",
      "name": "当被另一个工作流执行时",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -600,
        -20
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "text"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "a857fd97-8a53-4988-8bf0-dd7425725ca1",
      "name": "获取性能得分",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -340,
        -120
      ],
      "parameters": {
        "url": "INSERT_YOUR_ENDPOINT_URL_HERE",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"inputs\": {{ JSON.stringify($json.text) }},\n  \"parameters\": {}\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "huggingFaceApi"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "obk2OV7pJHPdAiyg",
          "name": "Header Auth account"
        },
        "huggingFaceApi": {
          "id": "N2L9e0Csws9dfDOW",
          "name": "HuggingFaceApi account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f4904bd1-bedb-46d9-84e3-4dcd11fbe7e1",
      "name": "获取偏好得分",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -340,
        80
      ],
      "parameters": {
        "url": "INSERT_YOUR_ENDPOINT_URL_HERE",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"inputs\": {{ JSON.stringify($json.text) }},\n  \"parameters\": {}\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "huggingFaceApi"
      },
      "credentials": {
        "huggingFaceApi": {
          "id": "N2L9e0Csws9dfDOW",
          "name": "HuggingFaceApi account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "33699ccd-31f2-4bca-81b8-ad00ca2263ba",
      "name": "设置性能得分",
      "type": "n8n-nodes-base.set",
      "position": [
        -120,
        -120
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1ba08ac6-99c3-4e2f-ba46-7f570fa35d10",
              "name": "performance_score",
              "type": "number",
              "value": "={{ $json.score }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "641838ba-ca68-4a0e-b9e0-9be37e4e8c32",
      "name": "获取偏好得分2",
      "type": "n8n-nodes-base.set",
      "position": [
        -120,
        80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1ba08ac6-99c3-4e2f-ba46-7f570fa35d10",
              "name": "preference_score",
              "type": "number",
              "value": "={{ $json.score }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3e215fed-abd6-43c0-b736-deec0d97c5fe",
      "name": "设置输出",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        -20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e1f63dc1-ad98-4a18-97f7-9f6053201875",
              "name": "performance_score",
              "type": "number",
              "value": "={{ $json.data[0].performance_score }}"
            },
            {
              "id": "928054ae-545d-43a8-a017-44dcf2bef749",
              "name": "preference_score",
              "type": "number",
              "value": "={{ $json.data[1].preference_score }}"
            },
            {
              "id": "22adbb02-16f4-426d-a2da-c9c18e5fdefe",
              "name": "text",
              "type": "string",
              "value": "={{ $('When Executed by Another Workflow').item.json.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5363b1e5-5045-4a8d-bade-f31e7b44c4b3",
      "name": "合并分支",
      "type": "n8n-nodes-base.merge",
      "position": [
        100,
        -20
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "eda4c1b6-3c6a-4c00-8b35-d7a8ba3d3db9",
      "name": "创建单个项目",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        280,
        -20
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "92b8d2e1-ea97-404f-abcc-997158c4ad3d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1260,
        -180
      ],
      "parameters": {
        "width": 560,
        "height": 460,
        "content": "## 子工作流设置:文本评分模型"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f7607f90-ee08-40f1-9565-0e6caca0c491",
  "connections": {
    "Merge Branches": {
      "main": [
        [
          {
            "node": "Create Single Item",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Single Item": {
      "main": [
        [
          {
            "node": "Set Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Preference Score": {
      "main": [
        [
          {
            "node": "Get Preference Score2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Performance Score": {
      "main": [
        [
          {
            "node": "Set Performance Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Preference Score2": {
      "main": [
        [
          {
            "node": "Merge Branches",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Set Performance Score": {
      "main": [
        [
          {
            "node": "Merge Branches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Get Performance Score",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Preference Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 市场调研, AI 摘要总结

需要付费吗?

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

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

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

作者
Open Paws

Open Paws

@openpaws

Open Paws is a nonprofit building open-source AI tools to accelerate animal advocacy. We create machine learning models and automation workflows trained on real-world campaign data to help end industrial animal exploitation. All tools are free, transparent, and designed for real-world impact.

外部链接
在 n8n.io 查看

分享此工作流