{
  "name": "[공무원] 2일차 P1 공문서 요약 + 기한 캘린더 등록",
  "nodes": [
    {
      "parameters": {
        "formTitle": "공문서 요약 서비스",
        "formDescription": "PDF 공문서를 올리면 AI가 핵심만 요약해 텔레그램으로 보내드립니다.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "PDF",
              "fieldType": "file",
              "multipleFiles": false,
              "acceptFileTypes": ".pdf",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.5,
      "position": [
        0,
        0
      ],
      "webhookId": "b7a1c40e-2f65-4d18-9a03-51c8e6d29f74",
      "id": "d2p1-form",
      "name": "공문서 업로드 폼"
    },
    {
      "parameters": {
        "operation": "pdf",
        "binaryPropertyName": "PDF",
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1.1,
      "position": [
        220,
        0
      ],
      "id": "d2p1-extract",
      "name": "PDF 텍스트 추출"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=다음 공문서를 5줄 이내로 핵심만 요약하세요.\n\n- 목적\n- 주요 내용\n- 지원 사항\n- 대상\n- 일정\n\n각 항목을 한 줄로 정리하세요.\n불필요한 설명은 하지 마세요.\n\n[문서 내용]\n{{ $json.text }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.9,
      "position": [
        440,
        0
      ],
      "id": "d2p1-ai",
      "name": "AI 요약"
    },
    {
      "parameters": {
        "modelName": "models/gemini-2.5-flash",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        380,
        180
      ],
      "id": "d2p1-gemini",
      "name": "Google Gemini Chat Model"
    },
    {
      "parameters": {
        "chatId": "여기에_본인_chat_id",
        "text": "=📄 공문서 요약\n\n{{ $json.text }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        660,
        0
      ],
      "webhookId": "5c9e2a71-8d34-4b60-ae12-7f0d3b95c218",
      "id": "d2p1-telegram",
      "name": "텔레그램 발송"
    },
    {
      "parameters": {
        "text": "={{ $json.text }}",
        "attributes": {
          "attributes": [
            {
              "name": "문서제목",
              "description": "공문서의 제목",
              "required": true
            },
            {
              "name": "제출기한",
              "description": "회신·제출의 마감 날짜를 YYYY-MM-DD 형식으로. 설명회·행사·조사 기간의 날짜와 헷갈리지 말 것. 마감이 없으면 빈 값"
            },
            {
              "name": "담당부서",
              "description": "공문을 보낸 부서 이름"
            },
            {
              "name": "필요조치",
              "description": "받는 기관이 해야 할 일을 한 줄로"
            }
          ]
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "typeVersion": 1.2,
      "position": [
        440,
        360
      ],
      "id": "5b2e8d41-93a7-4c06-b1f5-7a0d3c9e4a61",
      "name": "기한 추출"
    },
    {
      "parameters": {
        "modelName": "models/gemini-2.5-flash",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        380,
        540
      ],
      "id": "c9a4f730-2d58-4e1b-8a63-0f7e5b1d2c72",
      "name": "Google Gemini Chat Model1"
    },
    {
      "parameters": {
        "resource": "event",
        "operation": "create",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "본인이메일@example.com"
        },
        "start": "={{ $json.output.제출기한 + 'T09:00:00' }}",
        "end": "={{ $json.output.제출기한 + 'T10:00:00' }}",
        "additionalFields": {
          "summary": "=[공문 기한] {{ $json.output.문서제목 }}",
          "description": "=담당부서: {{ $json.output.담당부서 }}\n필요조치: {{ $json.output.필요조치 }}"
        }
      },
      "type": "n8n-nodes-base.googleCalendar",
      "typeVersion": 1.3,
      "position": [
        660,
        360
      ],
      "id": "e1d7b9c2-6f34-4a85-90be-2c8a5d3f7b83",
      "name": "기한 일정 등록"
    }
  ],
  "connections": {
    "공문서 업로드 폼": {
      "main": [
        [
          {
            "node": "PDF 텍스트 추출",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PDF 텍스트 추출": {
      "main": [
        [
          {
            "node": "AI 요약",
            "type": "main",
            "index": 0
          },
          {
            "node": "기한 추출",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI 요약": {
      "main": [
        [
          {
            "node": "텔레그램 발송",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI 요약",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "기한 추출": {
      "main": [
        [
          {
            "node": "기한 일정 등록",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "기한 추출",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
