{
  "name": "AI Summarizer (LLM-ready)",
  "nodes": [
    {
      "id": "ai-0001",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        200,
        300
      ],
      "parameters": {
        "path": "template/ai-summarizer",
        "httpMethod": "POST",
        "responseMode": "responseNode",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "ai-0002",
      "name": "Notas & Testes",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        80
      ],
      "parameters": {
        "color": 7,
        "width": 760,
        "height": 380,
        "content": "## Template: Resumidor com LLM (pronto para escalar)\n\n- Objetivo: Receber texto e gerar resumo com LLM ou fallback local.\n- Teste rápido:\n```bash\ncurl -X POST http://<SEU_N8N>/webhook/template/ai-summarizer \\\n -H 'Content-Type: application/json' \\\n -d '{\\\"text\\\":\\\"Escreva um parágrafo longo aqui...\\\"}'\n```\n- Produção: habilite o nó OpenAI e configure credenciais.\n- Fallback: 'Local Summarize' funciona sem credenciais."
      },
      "typeVersion": 1
    },
    {
      "id": "ai-0003",
      "name": "Prepare Text",
      "type": "n8n-nodes-base.set",
      "position": [
        460,
        300
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "txt",
              "name": "text",
              "type": "string",
              "value": "={{ $json.body?.text || 'Digite seu texto aqui para resumir.' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ai-0004",
      "name": "OpenAI (opcional)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        720,
        220
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "REPLACE_WITH_RESOURCE"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "Resuma de forma objetiva o seguinte texto:\n\n{{ $json.text }}"
            }
          ]
        }
      },
      "typeVersion": 1.5,
      "disabled": true
    },
    {
      "id": "ai-0005",
      "name": "Local Summarize",
      "type": "n8n-nodes-base.function",
      "position": [
        720,
        380
      ],
      "parameters": {
        "functionCode": "// Fallback simples: truncar e manter frases principais\nconst t = ($json.text || '').trim();\nif (!t) return [{ json: { summary: '' } }];\nconst max = 240;\nconst summary = t.length <= max ? t : t.slice(0, max) + '...';\nreturn [{ json: { summary } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "ai-0006",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        980,
        380
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}",
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "c702ecf2-5501-5c73-9e03-f87c1d9090dd",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -940,
        0
      ],
      "parameters": {
        "content": "# AI Summarizer (LLM-ready)\n\n## Purpose and structure\nThis folder contains the **AI Summarizer (LLM-ready)** workflow. Its executable nodes use `function`, `openAi`, `respondToWebhook`, `set`, `webhook`. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.\n\n## Setup\nImport inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.\n\n## Entry points\nWebhook\n\n## Verification\nSanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.\n\n## Attribution\nhttps://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Templates/9004_AI_Summarizer_Template_Webhook.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Prepare Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Text": {
      "main": [
        [
          {
            "node": "Local Summarize",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Local Summarize": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}
