{
  "name": "HYPEAKZ \u2014 Internal FAQ Chatbot (Self-Hosted, No SaaS)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "chatbot",
        "responseMode": "responseNode"
      },
      "id": "node-webhook",
      "name": "Chat Input",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "model": "llama3.2",
        "baseUrl": "http://ollama:11434"
      },
      "id": "node-ollama",
      "name": "Ollama Local LLM",
      "type": "@n8n/n8n-nodes-langchain.lmOllama",
      "typeVersion": 1,
      "position": [
        600,
        550
      ]
    },
    {
      "parameters": {
        "prompt": "You are an internal company FAQ assistant. You answer employee questions based on company knowledge.\n\nIMPORTANT RULES:\n1. Only answer based on the context/knowledge base provided below\n2. If you don't know the answer, say: \"I don't have that information. Please contact HR/IT/Management directly.\"\n3. Be concise and helpful\n4. Never make up policies or procedures\n5. Always be professional and friendly\n\n--- COMPANY KNOWLEDGE BASE ---\n{{ $json.body.knowledge_base || 'No knowledge base provided. Answer general workplace questions professionally and suggest the employee check with their manager or HR.' }}\n--- END KNOWLEDGE BASE ---\n\nEmployee Question: {{ $json.body.question }}\n\nProvide a clear, helpful answer. If the question relates to sensitive HR matters, always recommend speaking with HR directly."
      },
      "id": "node-answer",
      "name": "Generate Answer (AI)",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.4,
      "position": [
        600,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "question",
              "value": "={{ $('Chat Input').item.json.body.question }}"
            },
            {
              "name": "answer",
              "value": "={{ $json.text }}"
            },
            {
              "name": "timestamp",
              "value": "={{ $now.toISO() }}"
            },
            {
              "name": "model",
              "value": "llama3.2 (local)"
            }
          ]
        }
      },
      "id": "node-format",
      "name": "Format Response",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ answer: $json.answer, question: $json.question, timestamp: $json.timestamp }) }}"
      },
      "id": "node-respond",
      "name": "Return Answer",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1100,
        300
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "value": "FAQ Log"
        }
      },
      "id": "node-log",
      "name": "Log to Spreadsheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        1100,
        500
      ]
    }
  ],
  "connections": {
    "Chat Input": {
      "main": [
        [
          {
            "node": "Generate Answer (AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Local LLM": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Answer (AI)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Generate Answer (AI)": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Response": {
      "main": [
        [
          {
            "node": "Return Answer",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log to Spreadsheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [
    {
      "name": "HYPEAKZ.IO"
    },
    {
      "name": "Self-Hosted AI"
    },
    {
      "name": "Ollama"
    },
    {
      "name": "Chatbot"
    }
  ]
}