{
  "name": "会议纪要自动化工作流",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "meeting-upload",
        "options": {}
      },
      "name": "录音上传触发",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [0, 0]
    },
    {
      "parameters": {
        "url": "={{$json.body.audio_url}}",
        "method": "GET",
        "options": {}
      },
      "name": "下载录音",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [220, 0]
    },
    {
      "parameters": {
        "url": "https://api.openai.com/v1/audio/transcriptions",
        "method": "POST",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer YOUR_OPENAI_API_KEY" }
          ]
        },
        "sendBody": true,
        "specifyBody": "usingFields",
        "bodyParameters": {
          "parameters": [
            { "name": "model", "value": "whisper-1" },
            { "name": "file", "value": "={{$binary.data}}" },
            { "name": "response_format", "value": "json" },
            { "name": "language", "value": "zh" }
          ]
        },
        "options": {}
      },
      "name": "Whisper转录",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [440, 0]
    },
    {
      "parameters": {
        "url": "https://api.moonshot.cn/v1/chat/completions",
        "method": "POST",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer YOUR_LLM_API_KEY" },
            { "name": "Content-Type", "value": "application/json" }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"model\":\"moonshot-v1-8k\",\"messages\":[{\"role\":\"system\",\"content\":\"你是会议纪要助手。基于转写文本输出结构化纪要，仅输出JSON：{topic,issues[],decisions[],action_items[{task,owner,due}]}。过滤寒暄跑题，行动项要可执行，无负责人标待分配无日期标待定，不编造。\"},{\"role\":\"user\",\"content\":\"={{$json.text}}\"}]}",
        "options": {}
      },
      "name": "LLM结构化",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [660, 0]
    },
    {
      "parameters": {
        "jsCode": "const raw=$json.choices[0].message.content;const m=raw.match(/\\{[\\s\\S]*\\}/);const d=m?JSON.parse(m[0]):{topic:raw};const acts=(d.action_items||[]).map(a=>'- '+a.task+'（'+(a.owner||'待分配')+'，'+(a.due||'待定')+'）').join('\\n');const title=$('录音上传触发').item.json.body.meeting_title||'会议纪要';return{json:{topic:d.topic,issues:d.issues,decisions:d.decisions,action_items:d.action_items,feishu_text:'【'+title+'】\\n议题：'+(d.issues||[]).join('、')+'\\n决议：'+(d.decisions||[]).join('、')+'\\n待办：\\n'+acts}};"
      },
      "name": "解析JSON",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [880, 0]
    },
    {
      "parameters": {
        "url": "YOUR_FEISHU_BOT_WEBHOOK",
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"msg_type\":\"text\",\"content\":{\"text\":\"={{$json.feishu_text}}\"}}",
        "options": {}
      },
      "name": "飞书推送",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [1100, -160]
    },
    {
      "parameters": {
        "fromEmail": "minutes@yourcompany.com",
        "toEmail": "attendees@yourcompany.com",
        "subject": "={{'会议纪要：'+$json.topic}}",
        "emailFormat": "text",
        "message": "={{$json.feishu_text}}",
        "options": {}
      },
      "name": "邮件发送",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [1100, 0]
    },
    {
      "parameters": {
        "url": "https://api.notion.com/v1/pages",
        "method": "POST",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer YOUR_NOTION_TOKEN" },
            { "name": "Notion-Version", "value": "2022-06-28" },
            { "name": "Content-Type", "value": "application/json" }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"parent\":{\"database_id\":\"YOUR_NOTION_DATABASE_ID\"},\"properties\":{\"标题\":{\"title\":[{\"text\":{\"content\":\"={{$json.topic}}\"}}]}},\"children\":[{\"object\":\"block\",\"type\":\"paragraph\",\"paragraph\":{\"text\":[{\"text\":{\"content\":\"={{$json.feishu_text}}\"}}]}}]}",
        "options": {}
      },
      "name": "Notion入库",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [1100, 160]
    }
  ],
  "connections": {
    "录音上传触发": { "main": [ [{ "node": "下载录音", "type": "main", "index": 0 }] ] },
    "下载录音": { "main": [ [{ "node": "Whisper转录", "type": "main", "index": 0 }] ] },
    "Whisper转录": { "main": [ [{ "node": "LLM结构化", "type": "main", "index": 0 }] ] },
    "LLM结构化": { "main": [ [{ "node": "解析JSON", "type": "main", "index": 0 }] ] },
    "解析JSON": { "main": [ [{ "node": "飞书推送", "type": "main", "index": 0 }, { "node": "邮件发送", "type": "main", "index": 0 }, { "node": "Notion入库", "type": "main", "index": 0 }] ] }
  }
}
