私の辞書_複雑

上級

これはPersonal Productivity, Multimodal AI分野の自動化ワークフローで、22個のノードを含みます。主にIf, Set, Code, Webhook, Supabaseなどのノードを使用。 GPT-4o-miniとSupabaseで文学作品の英独中辞書を作成

前提条件
  • HTTP Webhookエンドポイント(n8nが自動生成)
  • Supabase URL と API Key
  • OpenAI API Key
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "6tW6bM6XI6pqrQgn",
  "meta": {
    "instanceId": "91e9d2c12dbfcdc2cb30d3665a714f8a4ee901c9fd6527015006b21570a93b53",
    "templateCredsSetupCompleted": true
  },
  "name": "My dictionary_complext",
  "tags": [],
  "nodes": [
    {
      "id": "87575fd4-3eda-4e20-8d6b-82a1ec37f1d5",
      "name": "AIエージェント",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -600,
        -360
      ],
      "parameters": {
        "text": "={{ $json.body.word }}",
        "options": {
          "systemMessage": "Purpose:\nYou are a bilingual dictionary assistant that helps users understand English and German words in the context of literature. It provides Chinese definitions and three literary-style sentence examples for each word, helping users deepen their vocabulary and reading comprehension.\n\nBehavior Guidelines:\n\nInput Handling:\n\nAccept single words in either English or German.\n\nDetect the language automatically.\n\nIf ambiguous, ask the user to clarify.\n\nResponse Format:\n\nLanguage: State the input language.\n\nWord: Bold the input word.\n\nPart of Speech: Indicate (e.g., noun, verb, adjective, etc.).\n\nChinese Meaning: Provide a concise and literary-relevant translation in Simplified Chinese.\n\nExamples:\n\nProvide three example sentences.\n\nThe sentences should be literary in tone or style (poetic, novelistic, expressive).\n\nProvide translations of the examples in Simplified Chinese beneath each.\n\nFocus on Literary Use:\n\nPrioritize literary, archaic, or metaphorical meanings when available.\n\nIf a word has multiple meanings, emphasize the one most relevant to literature.\n\nTone:\n\nKeep responses clear, elegant, and not overly academic.\n\nIf a word has rich etymology or symbolism, briefly mention it.\n\n🧪 Example Interaction\nUser Input: serenity\n\nYour Response:\n\nLanguage: English\nWord: serenity\nPart of Speech: Noun\nChinese Meaning: 宁静;安详;心灵的平和(常用于描写自然或人物的内心状态)\n\nExamples:\n\nThe serenity of the moonlit lake whispered secrets to the wind.\n月光湖面的宁静向微风低语着秘密。\n\nShe wore her serenity like a veil, untouched by the chaos around her.\n她带着一种宁静的气质,如面纱般将纷乱隔绝在外。\n\nIn the quiet of dawn, serenity settled over the forest like a benediction.\n黎明的静谧中,宁静如祝福般洒落在森林之上。"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "4547dfac-fb63-4950-8413-c93d4560f05e",
      "name": "Supabase",
      "type": "n8n-nodes-base.supabase",
      "position": [
        -360,
        420
      ],
      "parameters": {
        "tableId": "Dict",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "Words",
              "fieldValue": "={{ $json.body.word }}"
            },
            {
              "fieldId": "chineseMeaning",
              "fieldValue": "={{ $json.body.chineseMeaning }}"
            },
            {
              "fieldId": "Examples",
              "fieldValue": "={{ $json.body.examples }}"
            }
          ]
        }
      },
      "credentials": {
        "supabaseApi": {
          "id": "ot0Q4Due2nUmSxKx",
          "name": "Supabase account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e21676fe-0d24-4b15-8121-f6b0285cc5f4",
      "name": "条件分岐",
      "type": "n8n-nodes-base.if",
      "position": [
        -140,
        -360
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "71dec079-93c3-44c1-a798-a2c9df48cff5",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $('AI Agent').first().json.output }}",
              "rightValue": "It seems "
            },
            {
              "id": "52f131e5-69c7-4862-864f-76f336cf46a4",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $('AI Agent').first().json.output }}",
              "rightValue": "unclear"
            },
            {
              "id": "bc103838-6de4-4f72-bd67-03ea710c607f",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $('AI Agent').first().json.output }}",
              "rightValue": "please provide"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "eb58c75b-d4f3-4597-8b93-cd769a7e880d",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2240,
        -660
      ],
      "parameters": {
        "width": 540,
        "height": 1120,
        "content": "# Literary Dictionary Assistant \n\nThis n8n template creates a sophisticated bilingual dictionary that provides literary-style definitions and examples for English and German words with Chinese translations.\n\nUse cases are many: Language learning apps, reading comprehension tools, literary analysis, translation assistance, and vocabulary building for creative writing!\n\n## How it works\n\n* Input word is received via webhook and processed by the AI Agent with a specialized literary dictionary prompt.\n* OpenAI GPT-4o-mini generates comprehensive definitions with part of speech, Chinese meanings, and three literary-style example sentences.\n* Response formatting extracts structured data (word, meaning, examples with translations) from the AI output.\n* Quality control checks for unclear responses and returns appropriate error messages for invalid inputs.\n* Valid responses are simultaneously returned to the user and saved to Supabase database.\n* The workflow provides clean JSON API responses perfect for integration with apps or websites.\n\n## Good to know\n\n* The workflow automatically detects input language (English/German) and handles error cases gracefully.\n* All lookups are saved to Supabase database for building a personal vocabulary collection over time.\n\n## Requirements\n\n* OpenAI account with API access for GPT-4o-mini\n* Supabase account for database storage\n* Basic understanding of webhook APIs for integration\n\n## Customizing this workflow\n\n* Modify the system prompt to support additional languages or change the literary style (academic, casual, business-focused).\n* Add user authentication to create personalized vocabulary collections.\n* Integrate with reading apps, language learning platforms, or writing tools."
      },
      "typeVersion": 1
    },
    {
      "id": "7300514a-b5ea-40d0-8a29-02a1586cd124",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1140,
        -600
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 220,
        "content": "\n\n## 1. Webhook Receiver\n\nReceives word requests via HTTP POST. It captures the input word to be processed and triggers the entire workflow chain.\n\n**I use this Webhook to receive word input by user from a HTML web app**"
      },
      "typeVersion": 1
    },
    {
      "id": "a8b8f6f8-9dd3-465c-8a30-66132144e2e3",
      "name": "Openai 翻訳と例文作成",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -580,
        -180
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "sOk8ZfXyjEGfWIno",
          "name": "OpenAi account "
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3b794b96-5195-4771-bb5f-ea0ea99762a2",
      "name": "ユーザー応答",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        820,
        -500
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "6c4ce691-a8c5-4ff4-8cd5-1103af2d34ad",
      "name": "ユーザー応答1",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        820,
        -300
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "={{ JSON.stringify($('Format response').first().json) }}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "2e551b35-2292-4f47-ab5d-d1e658d18adc",
      "name": "エラーメッセージ整形",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        -500
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "{\n  \"error\": true,\n  \"message\": \"Please provide a specific word in English or German. The input was not recognized as a valid word.\",\n  \"word\": \"{{ $('Webhook').first().json.body.word }}\"\n}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "69ca7f02-6991-4ef9-bc1e-f900507838ab",
      "name": "レスポンス整形",
      "type": "n8n-nodes-base.code",
      "position": [
        400,
        -300
      ],
      "parameters": {
        "jsCode": "// Get the AI response from the previous node\nconst aiResponse = $('AI Agent').first().json.output;\n\n// Split the response into lines for parsing\nconst lines = aiResponse.split('\\n').filter(line => line.trim() !== '');\n\nlet word = '';\nlet chineseMeaning = '';\nlet examples = [];\n\n// Parse each line to extract the needed information\nlet inExamples = false;\nlet currentExample = '';\nlet currentTranslation = '';\n\nfor (let i = 0; i < lines.length; i++) {\n  const trimmedLine = lines[i].trim();\n  \n  // Extract the word (looking for \"Word: **word**\" format)\n  if (trimmedLine.startsWith('Word:')) {\n    // Remove \"Word:\" and extract text between ** markers\n    word = trimmedLine.replace('Word:', '').trim();\n    // Remove bold markdown formatting if present\n    word = word.replace(/\\*\\*/g, '').trim();\n  }\n  \n  // Extract Chinese meaning\n  if (trimmedLine.startsWith('Chinese Meaning:')) {\n    chineseMeaning = trimmedLine.replace('Chinese Meaning:', '').trim();\n  }\n  \n  // Check if we've reached the Examples section\n  if (trimmedLine === 'Examples:' || trimmedLine.startsWith('Examples:')) {\n    inExamples = true;\n    continue;\n  }\n  \n  // Parse examples when we're in the examples section\n  if (inExamples && trimmedLine) {\n    // Check if this line is an English sentence (not a Chinese translation)\n    // Chinese translations typically start with Chinese characters\n    const isChineseTranslation = /^[\\u4e00-\\u9fff]/.test(trimmedLine);\n    \n    if (!isChineseTranslation && trimmedLine.length > 10) {\n      // This is likely an English example sentence\n      // Save the previous example if we have both parts\n      if (currentExample && currentTranslation) {\n        examples.push({\n          sentence: currentExample,\n          translation: currentTranslation\n        });\n      }\n      \n      // Start a new example\n      currentExample = trimmedLine;\n      currentTranslation = '';\n    } else if (isChineseTranslation && currentExample) {\n      // This is the Chinese translation for the current example\n      currentTranslation = trimmedLine;\n    }\n  }\n}\n\n// Don't forget to add the last example if it exists\nif (currentExample && currentTranslation) {\n  examples.push({\n    sentence: currentExample,\n    translation: currentTranslation\n  });\n}\n\n// Return the structured data\nreturn {\n  word: word,\n  chineseMeaning: chineseMeaning,\n  examples: examples\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "6c366b3a-fb16-468a-8615-a86c58398378",
      "name": "Webhook ユーザーの単語入力を取得",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -940,
        -360
      ],
      "webhookId": "e50639d5-af5b-4523-864a-cb123250887f",
      "parameters": {
        "path": "e50639d5-af5b-4523-864a-cb123250887f",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "47059065-9d8c-40a0-8728-84e7030bab73",
      "name": "Webhook 単語をSupabaseに保存",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -940,
        420
      ],
      "webhookId": "e50639d5-af5b-4523-864a-cb123250887f",
      "parameters": {
        "path": "e50639d5-af5b-4523-864a-cb123250887f",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "6c098436-bbee-416d-9838-b57bb6bf71b7",
      "name": "応答メッセージ",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        120,
        420
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "={\n  \"success\": true,\n  \"message\": \"Word saved successfully\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "92eff8ea-f97e-44dc-b902-f384d89ebe92",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        -20
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 220,
        "content": "\n\n## 2. AI Agent\n\nI use specialized literary dictionary prompt. It will auto-detect language (English/German) and then generate comprehensive definitions. It will also create 3 literary-style example sentences."
      },
      "typeVersion": 1
    },
    {
      "id": "62945248-fb2d-4a4c-8479-6f7f3d6b1d75",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        -140
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 220,
        "content": "\n\n## 4. Data Structure Parser\n\nIt extracts structured data from AI output and organizes: word, part of speech, meanings\nFormats examples with translations\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9b3eb8d6-9210-466e-885f-3015c1c97854",
      "name": "付箋4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        -640
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 220,
        "content": "\n\n## 3. Error Handler \n\nThis if node checks for unclear or invalid responses and returns appropriate error messages\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8a7c23e1-d537-491d-b4c8-e7b933e3709d",
      "name": "付箋5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1620,
        420
      ],
      "parameters": {
        "color": 3,
        "width": 440,
        "height": 100,
        "content": "\n\n## Workflow for data storage"
      },
      "typeVersion": 1
    },
    {
      "id": "55d3c004-cb9a-41cc-884e-829785a8ffe4",
      "name": "付箋6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1620,
        -360
      ],
      "parameters": {
        "color": 3,
        "width": 440,
        "height": 100,
        "content": "\n\n## Workflow for looking up words\n"
      },
      "typeVersion": 1
    },
    {
      "id": "07bc4443-1d63-4c29-8cbd-386522c73ed2",
      "name": "付箋7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        620
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 220,
        "content": "\n\n## 2. Supabase Integration\n\nIt saves all valid lookups to database and builds personal structured dictionary data.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "75a5c8ec-f15c-48dd-b140-2eaee66cd85b",
      "name": "付箋8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        400
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 220,
        "content": "\n\n## 3. Webhook Response Node\n\nIt completes the workflow by sending the final response back to the requesting user: \"Word saved successfully\".\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a05d401b-792f-437d-bdd1-f08285e5ee9f",
      "name": "付箋9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1120,
        620
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 220,
        "content": "\n\n## 1. Save Words Trigger\n\nWhen the user clicks the \" Save to vocabulary list\" button, it will trigger this workflow and the word will be saved to Supabase.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "27e60f98-b4ea-4b29-a2d2-c53b6b786d96",
      "name": "付箋10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1060,
        -500
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 320,
        "content": "\n\n## 5. Webhook Response Node\n\nIt completes this workflow by sending the final response back to the requesting user. It is either\n\n* includes the complete dictionary data (word, definitions, examples, translations).\n\nor\n\n* \"Please provide a specific word in English or German. The input was not recognized as a valid word.\"\n\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "03878a15-0672-4cd3-baf8-40b47c357052",
  "connections": {
    "e21676fe-0d24-4b15-8121-f6b0285cc5f4": {
      "main": [
        [
          {
            "node": "2e551b35-2292-4f47-ab5d-d1e658d18adc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "69ca7f02-6991-4ef9-bc1e-f900507838ab",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "87575fd4-3eda-4e20-8d6b-82a1ec37f1d5": {
      "main": [
        [
          {
            "node": "e21676fe-0d24-4b15-8121-f6b0285cc5f4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4547dfac-fb63-4950-8413-c93d4560f05e": {
      "main": [
        [
          {
            "node": "6c098436-bbee-416d-9838-b57bb6bf71b7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "69ca7f02-6991-4ef9-bc1e-f900507838ab": {
      "main": [
        [
          {
            "node": "6c4ce691-a8c5-4ff4-8cd5-1103af2d34ad",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6c4ce691-a8c5-4ff4-8cd5-1103af2d34ad": {
      "main": [
        []
      ]
    },
    "2e551b35-2292-4f47-ab5d-d1e658d18adc": {
      "main": [
        [
          {
            "node": "3b794b96-5195-4771-bb5f-ea0ea99762a2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a8b8f6f8-9dd3-465c-8a30-66132144e2e3": {
      "ai_languageModel": [
        [
          {
            "node": "87575fd4-3eda-4e20-8d6b-82a1ec37f1d5",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "6c366b3a-fb16-468a-8615-a86c58398378": {
      "main": [
        [
          {
            "node": "87575fd4-3eda-4e20-8d6b-82a1ec37f1d5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "47059065-9d8c-40a0-8728-84e7030bab73": {
      "main": [
        [
          {
            "node": "4547dfac-fb63-4950-8413-c93d4560f05e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

上級 - 個人の生産性, マルチモーダルAI

有料ですか?

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

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

上級者向け、16ノード以上の複雑なワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34