8
n8n 中文网amn8n.com

unli.dev图像分析器

中级

这是一个Invoice Processing, Multimodal AI领域的自动化工作流,包含 6 个节点。主要使用 Set, Code, Telegram, HttpRequest, TelegramTrigger 等节点。 使用unli.dev Vision API和Telegram从图像中提取交易记录

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "7CdWmTSFuTCbGS5F",
  "meta": {
    "instanceId": "c2650793f644091dc80fb900fe63448ad1f4b774008de9608064d67294f8307c",
    "templateCredsSetupCompleted": true
  },
  "name": "unli.dev图像分析器",
  "tags": [],
  "nodes": [
    {
      "id": "311a97ac-7c23-4fae-8572-bdd869e44460",
      "name": "📤 发送响应",
      "type": "n8n-nodes-base.telegram",
      "position": [
        528,
        416
      ],
      "webhookId": "ebeb27ef-0f91-4313-ad5c-e60de9e7b80e",
      "parameters": {
        "text": "=📸 **Image Analysis Result**\n\n{{ $json.choices[0].message.content }}\n\nModel: {{ $json.model }}\nprompt tokens: {{ $json.usage.prompt_tokens }}\ncompletion tokens: {{ $json.usage.completion_tokens }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "wlH3um2hoPAGI8XX",
          "name": "Khaisa Dev Bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c9bd6275-58e2-4b16-a200-6b8f1070fa1b",
      "name": "转换为Base",
      "type": "n8n-nodes-base.code",
      "position": [
        -80,
        416
      ],
      "parameters": {
        "jsCode": "const binaryData = $input.first().binary.data;\n\n// Access buffer property and convert to base64\nconst base64Image = binaryData.data.toString('base64');\n\n// Get the caption from the original Telegram message if it exists\nconst caption = $('Telegram Trigger').item.json.message.caption || 'What is in this image?';\n\nreturn [{ \n  json: { \n    base64Image: base64Image,\n    prompt: caption,\n    chatId: $('Telegram Trigger').item.json.message.chat.id,\n    messageId: $('Telegram Trigger').item.json.message.message_id\n  } \n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "49b95148-ca6f-4392-97f3-d664f5d5d273",
      "name": "设置请求",
      "type": "n8n-nodes-base.set",
      "position": [
        128,
        416
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "model",
              "stringValue": "auto"
            },
            {
              "name": "base64Image",
              "stringValue": "={{ $json.base64Image }}"
            },
            {
              "name": "userPrompt",
              "stringValue": "extract the trancastion on this image. output in md format"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "1309d7db-82d3-47d4-99f3-2045664bc78f",
      "name": "📥 下载图像",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -288,
        416
      ],
      "webhookId": "7d9d13d4-ec19-40d7-a905-0b44b58867d9",
      "parameters": {
        "fileId": "={{ $('Telegram Trigger').item.json.message.photo[3].file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "wlH3um2hoPAGI8XX",
          "name": "Khaisa Dev Bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "50024d75-3377-45ef-95c9-683766b87fa8",
      "name": "Telegram触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -496,
        416
      ],
      "webhookId": "f460f87e-fb6b-4854-a012-46de743f7695",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "wlH3um2hoPAGI8XX",
          "name": "Khaisa Dev Bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "03857f42-2145-4a91-b49d-88d0cedb9eb5",
      "name": "调用视觉API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        336,
        416
      ],
      "parameters": {
        "url": "https://api.unli.dev/v1/chat/completions",
        "method": "POST",
        "options": {
          "timeout": 120000
        },
        "jsonBody": "={\n  \"model\": \"{{ $json.model }}\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"image_url\",\n          \"image_url\": {\n            \"url\": \"data:image/jpeg;base64,{{ $json.base64Image }}\"\n          }\n        },\n        {\n          \"type\": \"text\",\n          \"text\": \"{{ $json.prompt }}\"\n        }\n      ]\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "orxLpGp8WTDwNIaF",
          "name": "Unli.dev - Jon"
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": true,
  "pinData": {
    "Telegram Trigger": [
      {
        "json": {
          "message": {
            "chat": {
              "id": 621412350,
              "type": "private",
              "username": "Khmuhtadin",
              "first_name": "khairul"
            },
            "date": 1755771042,
            "from": {
              "id": 621412350,
              "is_bot": false,
              "username": "Khmuhtadin",
              "first_name": "khairul",
              "language_code": "en"
            },
            "photo": [
              {
                "width": 42,
                "height": 90,
                "file_id": "AgACAgUAAxkBAAIrV2im8KIxcwHODUo6awNsS68yvjPxAAJ90TEbFQ45VT_PGhSGK0w_AQADAgADcwADNgQ",
                "file_size": 1276,
                "file_unique_id": "AQADfdExGxUOOVV4"
              },
              {
                "width": 148,
                "height": 320,
                "file_id": "AgACAgUAAxkBAAIrV2im8KIxcwHODUo6awNsS68yvjPxAAJ90TEbFQ45VT_PGhSGK0w_AQADAgADbQADNgQ",
                "file_size": 16029,
                "file_unique_id": "AQADfdExGxUOOVVy"
              },
              {
                "width": 369,
                "height": 800,
                "file_id": "AgACAgUAAxkBAAIrV2im8KIxcwHODUo6awNsS68yvjPxAAJ90TEbFQ45VT_PGhSGK0w_AQADAgADeAADNgQ",
                "file_size": 68479,
                "file_unique_id": "AQADfdExGxUOOVV9"
              },
              {
                "width": 591,
                "height": 1280,
                "file_id": "AgACAgUAAxkBAAIrV2im8KIxcwHODUo6awNsS68yvjPxAAJ90TEbFQ45VT_PGhSGK0w_AQADAgADeQADNgQ",
                "file_size": 92733,
                "file_unique_id": "AQADfdExGxUOOVV-"
              }
            ],
            "message_id": 11095
          },
          "update_id": 602987959
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "19150b3b-1dc8-4310-870d-6d735f59214e",
  "connections": {
    "Set Request": {
      "main": [
        [
          {
            "node": "Call Vision API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call Vision API": {
      "main": [
        [
          {
            "node": "📤 Send Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to Base": {
      "main": [
        [
          {
            "node": "Set Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "📥 Download Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📥 Download Image": {
      "main": [
        [
          {
            "node": "Convert to Base",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 发票处理, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流