{
 "name": "[노드 한 장] Sentiment Analysis · 리뷰를 긍정·중립·부정으로",
 "nodes": [
  {
   "id": "s1",
   "name": "Run manually",
   "type": "n8n-nodes-base.manualTrigger",
   "typeVersion": 1,
   "position": [
    0,
    200
   ],
   "parameters": {}
  },
  {
   "id": "s2",
   "name": "Get recent reviews",
   "type": "n8n-nodes-base.httpRequest",
   "typeVersion": 4.2,
   "position": [
    220,
    200
   ],
   "parameters": {
    "url": "https://store.steampowered.com/ajaxappreviews/4435490?json=1&l=english&language=english&num_per_page=20&filter=recent&purchase_type=all",
    "options": {}
   }
  },
  {
   "id": "s3",
   "name": "One review per item",
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "position": [
    440,
    200
   ],
   "parameters": {
    "jsCode": "// 40자 이상 리뷰만, 욕설·가림(♥) 들어간 리뷰는 제외\nconst bad = /♥|shit|fuck|molest|bitch|damn/i;\nconst r = $input.first().json.reviews || [];\nreturn r\n  .filter(x => x.review.trim().length >= 40 && !bad.test(x.review))\n  .map((x, i) => ({ json: {\n    no: i + 1,\n    steam_recommended: x.voted_up,\n    review: x.review.replace(/\\s+/g, ' ').trim().slice(0, 400)\n  }}));"
   }
  },
  {
   "id": "s4",
   "name": "Sentiment Analysis",
   "type": "@n8n/n8n-nodes-langchain.sentimentAnalysis",
   "typeVersion": 1,
   "position": [
    680,
    200
   ],
   "parameters": {
    "inputText": "={{ $json.review }}",
    "options": {
     "categories": "Positive, Neutral, Negative",
     "includeDetailedResults": true
    }
   }
  },
  {
   "id": "s5",
   "name": "OpenAI Chat Model",
   "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
   "typeVersion": 1.2,
   "position": [
    680,
    420
   ],
   "parameters": {
    "model": {
     "__rl": true,
     "mode": "list",
     "value": "gpt-4.1-mini",
     "cachedResultName": "gpt-4.1-mini"
    },
    "options": {
     "temperature": 0
    }
   }
  },
  {
   "id": "s6",
   "name": "Label: positive",
   "type": "n8n-nodes-base.set",
   "typeVersion": 3.4,
   "position": [
    960,
    60
   ],
   "parameters": {
    "assignments": {
     "assignments": [
      {
       "id": "p1",
       "name": "no",
       "type": "number",
       "value": "={{ $json.no }}"
      },
      {
       "id": "p2",
       "name": "ai_sentiment",
       "type": "string",
       "value": "긍정"
      },
      {
       "id": "p3",
       "name": "steam_recommended",
       "type": "boolean",
       "value": "={{ $json.steam_recommended }}"
      },
      {
       "id": "p4",
       "name": "strength",
       "type": "number",
       "value": "={{ $json.sentimentAnalysis.strength }}"
      },
      {
       "id": "p5",
       "name": "confidence",
       "type": "number",
       "value": "={{ $json.sentimentAnalysis.confidence }}"
      }
     ]
    },
    "options": {}
   }
  },
  {
   "id": "s7",
   "name": "Label: neutral",
   "type": "n8n-nodes-base.set",
   "typeVersion": 3.4,
   "position": [
    960,
    220
   ],
   "parameters": {
    "assignments": {
     "assignments": [
      {
       "id": "u1",
       "name": "no",
       "type": "number",
       "value": "={{ $json.no }}"
      },
      {
       "id": "u2",
       "name": "ai_sentiment",
       "type": "string",
       "value": "중립"
      },
      {
       "id": "u3",
       "name": "steam_recommended",
       "type": "boolean",
       "value": "={{ $json.steam_recommended }}"
      },
      {
       "id": "u4",
       "name": "strength",
       "type": "number",
       "value": "={{ $json.sentimentAnalysis.strength }}"
      },
      {
       "id": "u5",
       "name": "confidence",
       "type": "number",
       "value": "={{ $json.sentimentAnalysis.confidence }}"
      }
     ]
    },
    "options": {}
   }
  },
  {
   "id": "s8",
   "name": "Label: negative",
   "type": "n8n-nodes-base.set",
   "typeVersion": 3.4,
   "position": [
    960,
    380
   ],
   "parameters": {
    "assignments": {
     "assignments": [
      {
       "id": "n1",
       "name": "no",
       "type": "number",
       "value": "={{ $json.no }}"
      },
      {
       "id": "n2",
       "name": "ai_sentiment",
       "type": "string",
       "value": "부정"
      },
      {
       "id": "n3",
       "name": "steam_recommended",
       "type": "boolean",
       "value": "={{ $json.steam_recommended }}"
      },
      {
       "id": "n4",
       "name": "strength",
       "type": "number",
       "value": "={{ $json.sentimentAnalysis.strength }}"
      },
      {
       "id": "n5",
       "name": "confidence",
       "type": "number",
       "value": "={{ $json.sentimentAnalysis.confidence }}"
      }
     ]
    },
    "options": {}
   }
  }
 ],
 "connections": {
  "Run manually": {
   "main": [
    [
     {
      "node": "Get recent reviews",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Get recent reviews": {
   "main": [
    [
     {
      "node": "One review per item",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "One review per item": {
   "main": [
    [
     {
      "node": "Sentiment Analysis",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "OpenAI Chat Model": {
   "ai_languageModel": [
    [
     {
      "node": "Sentiment Analysis",
      "type": "ai_languageModel",
      "index": 0
     }
    ]
   ]
  },
  "Sentiment Analysis": {
   "main": [
    [
     {
      "node": "Label: positive",
      "type": "main",
      "index": 0
     }
    ],
    [
     {
      "node": "Label: neutral",
      "type": "main",
      "index": 0
     }
    ],
    [
     {
      "node": "Label: negative",
      "type": "main",
      "index": 0
     }
    ]
   ]
  }
 },
 "settings": {
  "timezone": "Asia/Seoul",
  "executionOrder": "v1"
 },
 "meta": {
  "templateCredsSetupCompleted": false,
  "source": "datapopcorn.ai/workflow/nodes"
 }
}