Typhoon_による提出

中級

これはAI, IT Ops分野の自動化ワークフローで、8個のノードを含みます。主にCode, GoogleSheets, ManualTrigger, ReadWriteFile, ExecuteCommandなどのノードを使用、AI技術を活用したスマート自動化を実現。 Typhoon OCRとLlama 3.1を使用してタイ語ドキュメントを抽出・構造化し、Google Sheetsに保存

前提条件
  • Google Sheets API認証情報

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "iPCOP0dstJZlKFQS",
  "meta": {
    "instanceId": "e2034325698638870d6b764285427bad9d79bf1e08a458be597c06e61ad7e545",
    "templateCredsSetupCompleted": true
  },
  "name": "Typhoon_Submit",
  "tags": [],
  "nodes": [
    {
      "id": "7d7df2fd-bc12-4850-aa9a-3e318bfed747",
      "name": "「Test workflow」クリック時",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        40,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "58290920-9b18-47dd-82b9-62c340b7ed53",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        600,
        120
      ],
      "parameters": {
        "model": "scb10x/llama3.1-typhoon2-70b-instruct",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "dyclDhheSN7TDEE9",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d42f2a8d-7bd5-462d-932c-34ee5de16592",
      "name": "Typhoon OCRでテキスト抽出",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        420,
        0
      ],
      "parameters": {
        "command": "=python -c \"import sys, os; os.environ['TYPHOON_OCR_API_KEY'] = '<YourTyphoonKey>'; from typhoon_ocr import ocr_document; sys.stdout.reconfigure(encoding='utf-8'); input_path = sys.argv[1]; text = ocr_document(input_path); print(text)\" \"doc/{{$json[\"fileName\"]}}\"",
        "executeOnce": false
      },
      "typeVersion": 1
    },
    {
      "id": "d6d13619-f704-45d0-85fc-3e5b9dc4bd7a",
      "name": "LLMでテキストをJSONに構造化",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        600,
        0
      ],
      "parameters": {
        "text": "=ข้อความด้านล่างนี้เป็นเนื้อหา OCR จากหนังสือราชการ กรุณาแยกหัวข้อสำคัญออกมาในรูปแบบ JSON:\n\n1. book_id: เลขที่หนังสือ\n2. date: วันที่ในเอกสาร\n3. subject: หัวเรื่อง\n4. to: เรียน\n5. attach: สิ่งที่ส่งมาด้วย\n6. detail: เนื้อความในหนังสือ\n7. signed_by: ผู้ลงนาม\n8. signed_by2: ตำแหน่งผู้ลงนาม\n9. contact: ช่องทางติดต่อ (เช่น เบอร์โทร อีเมล)\n10. download_url: ลิงก์สำหรับดาวน์โหลด (ถ้ามี)\n\nOCR_TEXT:\n\"\"\"\n{{ $json[\"stdout\"] }}\n\"\"\"",
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "eaa9580c-9b98-42dc-a164-38430df41459",
      "name": "JSONをシート形式に解析",
      "type": "n8n-nodes-base.code",
      "position": [
        940,
        0
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const raw = $json[\"text\"];\n\n// 1. ลบ ```json และ ``` ที่ LLM อาจใส่มา\nconst cleaned = raw.replace(/```json\\n?|```/g, \"\").trim();\n\nlet parsed;\ntry {\n  // 2. แปลงเป็น object\n  parsed = JSON.parse(cleaned);\n} catch (err) {\n  throw new Error(\"JSON parsing failed: \" + err.message + \"\\n\\nRaw text:\\n\" + cleaned);\n}\n\n// 3. หาก contact เป็น object แยก field ออกมา\nconst contact = parsed.contact || {};\n\nreturn {\n  book_id: parsed.book_id || \"\",\n  date: parsed.date || \"\",\n  subject: parsed.subject || \"\",\n  to: parsed.to || \"\",\n  attach: parsed.attach || \"\",\n  detail: parsed.detail || \"\",\n  signed_by: parsed.signed_by || \"\",\n  signed_by2: parsed.signed_by2 || \"\",\n  contact_phone: contact.phone || \"\",\n  contact_email: contact.email || \"\",\n  contact_fax: contact.fax || \"\",\n  download_url: parsed.download_url || \"\"\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "8e3e5e7e-d329-459e-bd85-31fc2f76144b",
      "name": "Googleシートに保存",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1120,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "to": "={{ $json.to }}",
            "date": "={{ $json.date }}",
            "attach": "={{ $json.attach }}",
            "detail": "={{ $json.detail }}",
            "book_id": "={{ $json.book_id }}",
            "subject": "={{ $json.subject }}",
            "signed_by": "={{ $json.signed_by }}",
            "signed_by2": "={{ $json.signed_by2 }}",
            "contact_fax": "={{ $json.contact_fax }}",
            "download_url": "={{ $json.download_url }}",
            "contact_email": "={{ $json.contact_email }}",
            "contact_phone": "={{ $json.contact_phone }}"
          },
          "schema": [
            {
              "id": "book_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "book_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "subject",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "to",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "to",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "attach",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "attach",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "detail",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "detail",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "signed_by",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "signed_by",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "signed_by2",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "signed_by2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contact_phone",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "contact_phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contact_email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "contact_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contact_fax",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "contact_fax",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "download_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "download_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "book_id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1h70cJyLj5i2j0Ag5kqp93ccZjjhJnqpLmz-ee5r4brU/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1h70cJyLj5i2j0Ag5kqp93ccZjjhJnqpLmz-ee5r4brU",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1h70cJyLj5i2j0Ag5kqp93ccZjjhJnqpLmz-ee5r4brU/edit?usp=drivesdk",
          "cachedResultName": "TyphoonOCR_Extracted_Data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "Ra2f1dlqOJ13jTtb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "7b20ef0a-5d1f-4efe-bac3-53ace280cac2",
      "name": "docフォルダからPDFを読み込み",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        220,
        0
      ],
      "parameters": {
        "options": {},
        "fileSelector": "doc/*"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "944977eb-2db6-430f-957e-345541ba8d39",
      "name": "付箋メモ",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -100
      ],
      "parameters": {
        "width": 1320,
        "height": 360,
        "content": "## Thai OCR to Sheet\nThis workflow extracts Thai PDF text using typhoon-ocr, converts it to structured JSON using LLM, and saves the output to Google Sheets. Works with self-hosted n8n only."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "dc1bd760-0abe-4125-b2f6-2eeb4d9b02eb",
  "connections": {
    "58290920-9b18-47dd-82b9-62c340b7ed53": {
      "ai_languageModel": [
        [
          {
            "node": "d6d13619-f704-45d0-85fc-3e5b9dc4bd7a",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "7b20ef0a-5d1f-4efe-bac3-53ace280cac2": {
      "main": [
        [
          {
            "node": "d42f2a8d-7bd5-462d-932c-34ee5de16592",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "eaa9580c-9b98-42dc-a164-38430df41459": {
      "main": [
        [
          {
            "node": "8e3e5e7e-d329-459e-bd85-31fc2f76144b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d42f2a8d-7bd5-462d-932c-34ee5de16592": {
      "main": [
        [
          {
            "node": "d6d13619-f704-45d0-85fc-3e5b9dc4bd7a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d6d13619-f704-45d0-85fc-3e5b9dc4bd7a": {
      "main": [
        [
          {
            "node": "eaa9580c-9b98-42dc-a164-38430df41459",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7d7df2fd-bc12-4850-aa9a-3e318bfed747": {
      "main": [
        [
          {
            "node": "7b20ef0a-5d1f-4efe-bac3-53ace280cac2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - 人工知能, IT運用

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数8
カテゴリー2
ノードタイプ8
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
Jaruphat J.

Jaruphat J.

@jaruphatj

Project Manager who passionate about Automation & AI and continuously explore innovative ways to improve business processes through intelligent workflow automation. Let’s connect and automate the future!

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34