{
  "name": "GitHub AI 每日推荐",
  "nodes": [
    {
      "parameters": {
        "rule": {"interval": [{"field": "cron", "hours": [8], "minutes": [0]}]}
      },
      "id": "schedule-trigger",
      "name": "定时触发",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [0, 300]
    },
    {
      "parameters": {
        "url": "https://api.github.com/search/repositories?q=AI+OR+LLM+OR+GPT+OR+artificial+intelligence&sort=stars&order=desc&per_page=30",
        "options": {"headers": {"Accept": "application/vnd.github.v3+json"}}
      },
      "id": "github-api",
      "name": "获取 GitHub 项目",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [250, 300]
    },
    {
      "parameters": {
        "jsCode": "const data = $input.all()[0].json;\nconst items = data.items || [];\nconst aiKeywords = ['ai','llm','gpt','neural','model','embedding','rag','agent','chatbot','ml','deep learning','transformer','ollama','langchain','vector','copilot','openai','claude','gemini'];\nconst aiProjects = items.filter(repo => {\n  const desc = (repo.description || '').toLowerCase();\n  const name = repo.name.toLowerCase();\n  const topics = (repo.topics || []).map(t => t.toLowerCase());\n  const combined = desc + ' ' + name + ' ' + topics.join(' ');\n  return aiKeywords.some(kw => combined.includes(kw));\n}).slice(0, 5);\nconst projectList = aiProjects.map((repo, i) => {\n  return (i+1) + '. ' + repo.name + ' - ' + (repo.description || '暂无描述') + ' (Stars: ' + repo.stargazers_count + ') URL: ' + repo.html_url;\n}).join('\\n');\n\nconst systemPrompt = '你是一个专业的AI技术资讯助手，用简洁专业的语言为用户推荐AI开源项目。总字数控制在200字以内，用emoji增加可读性';\nconst userPrompt = '请分析并推荐以下GitHub上的AI项目：\\n' + projectList + '\\n\\n请按格式输出：项目名称\\n⭐ Stars数\\n📝 简要说明\\n👥 适合人群\\n🌟 亮点';\n\nreturn [{json: {projects: projectList, projectData: aiProjects, systemPrompt, userPrompt}}];"
      },
      "id": "filter-projects",
      "name": "筛选 AI 项目",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [500, 300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.minimax.chat/v1/chat/completions",
        "sendBody": true,
        "specifyBody": "keypair",
        "bodyParameters": {
          "parameters": [
            {"name": "model", "value": "MiniMax-M2.7"},
            {"name": "messages", "value": "[{\"role\":\"system\",\"content\":\"{{ $json.systemPrompt }}\"},{\"role\":\"user\",\"content\":\"{{ $json.userPrompt }}\"}]"}
          ]
        }
      },
      "id": "minimax-ai",
      "name": "MiniMax AI 分析",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [750, 300]
    },
    {
      "parameters": {
        "jsCode": "const minimaxResponse = $input.all()[0].json;\nconst choices = minimaxResponse.choices || [];\nconst aiAnalysis = choices[0]?.message?.content || '暂无AI分析';\nconst projectData = $('筛选 AI 项目').first().json.projectData || [];\nconst header = '🌅 早安！今日 AI 开源项目推荐\\n\\n';\nconst analysis = '🤖 AI 智能分析：\\n' + aiAnalysis + '\\n\\n';\nconst links = '📚 详情链接：\\n' + projectData.map((p, i) => (i+1) + '. ' + p.html_url).join('\\n') + '\\n\\n—— n8n via MiniMax-M2.7';\nreturn [{json: {message: header + analysis + links}}];"
      },
      "id": "format-message",
      "name": "格式化消息",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [1000, 300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.telegram.org/bot8611088557:AAF9JAnKtYDkrjhpiXSoDAQKcubBNCVNUQU/sendMessage",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {"name": "chat_id", "value": "5766525026"},
            {"name": "text", "value": "={{ $json.message }}"}
          ]
        }
      },
      "id": "telegram-send",
      "name": "Telegram 发送",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1250, 300]
    }
  ],
  "connections": {
    "定时触发": {"main": [[{"node": "获取 GitHub 项目", "type": "main", "index": 0}]]},
    "获取 GitHub 项目": {"main": [[{"node": "筛选 AI 项目", "type": "main", "index": 0}]]},
    "筛选 AI 项目": {"main": [[{"node": "MiniMax AI 分析", "type": "main", "index": 0}]]},
    "MiniMax AI 分析": {"main": [[{"node": "格式化消息", "type": "main", "index": 0}]]},
    "格式化消息": {"main": [[{"node": "Telegram 发送", "type": "main", "index": 0}]]}
  },
  "active": true
}
