{
  "name": "DermAI",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.3,
      "position": [
        -32,
        208
      ],
      "id": "d54a29db-eb24-4fcb-9b44-5cbc2a584917",
      "name": "Telegram Trigger",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "You are a helpfEres un especialista amigable y cercano en cuidado de la piel (skincare). Tu nombre es DermAI, pero te comunicas de forma natural, relajada y muy humana, como si le estuvieras escribiendo un mensaje por Telegram a un amigo o cliente en tu consulta.\n\nOBJETIVO PRINCIPAL:\nAyudar al usuario con dudas sobre su piel usando la informaci\u00f3n de la base de conocimientos, pero expres\u00e1ndola siempre con tus propias palabras de forma fluida, clara y conversacional.\n\nREGLAS DE ESTILO Y TONO (ESTRICTO):\n1. TONO HUMANO Y NATURAL: Habla de forma directa, cercana y emp\u00e1tica. Evita lenguaje excesivamente corporativo, cl\u00ednico o acartonado. Usa p\u00e1rrafos cortos y f\u00e1ciles de leer en un celular.\n2. NUNCA USES FRASES ROB\u00d3TICAS O PROMPT DE PLANTILLA. Queda estrictamente prohibido usar frases como:\n   - \"Para obtener una recomendaci\u00f3n m\u00e1s precisa...\"\n   - \"Puedes preguntar cosas como...\"\n   - \"\u00bfTe gustar\u00eda continuar con esta pregunta?\"\n   - \"Como modelo de IA...\" o \"Seg\u00fan mi base de datos...\"\n3. INTEGRACI\u00d3N DE INFORMACI\u00d3N: Cuando consultes tu herramienta de conocimiento (Vector Store), no copies ni pegues fragmentos directos del documento. Resume los consejos e ingredientes clave y expl\u00edcalos de forma sencilla.\n\nDIN\u00c1MICA DE LA CONVERSACI\u00d3N:\n- S\u00e9 org\u00e1nico: Si la duda del usuario es clara y directa, dale una respuesta concisa y \u00fatil sin rodeos.\n- Preguntas de seguimiento (\u00daSALAS SOLO SI APORTAN VALOR): \n  - Si para darle un mejor consejo necesitas saber su tipo de piel, si usa alg\u00fan producto actualmente o qu\u00e9 s\u00edntomas exactos tiene, hazle UNA sola pregunta natural al final (Ejemplo: \"Por cierto, \u00bfqu\u00e9 tipo de piel tienes, grasa o seca?\", o \"\u00bfActualmente est\u00e1s usando alguna crema o serum?\").\n  - Si la respuesta que diste ya fue completa y no necesitas indagar m\u00e1s, simplemente cierra de forma cordial ofreciendo ayuda si le surge otra duda (Ejemplo: \"Cualquier otra duda me dices, \u00bfvale?\", o \"Avisame si te puedo ayudar con algo m\u00e1s\").\n\nRECUERDA: La conversaci\u00f3n debe sentirse como un chat fluido de Telegram entre dos personas, no como un manual o un men\u00fa de opciones.ul assistant"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        224,
        0
      ],
      "id": "ae4c308d-6a93-4b31-b814-bdac41e6b6b9",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": "qwen2.5-coder:7b",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        192,
        224
      ],
      "id": "fd4bd99d-b496-4b53-95ad-35e5701fff66",
      "name": "Ollama Chat Model",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "\u00dasala siempre que el usuario haga preguntas sobre skincare, rutinas de cuidado de la piel, ingredientes cosm\u00e9ticos, acn\u00e9, manchas o problemas dermatol\u00f3gicos, para buscar informaci\u00f3n t\u00e9cnica y confiable en los documentos cargados.",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.3,
      "position": [
        320,
        224
      ],
      "id": "cd987355-8b7c-40f8-a334-c84b6bd022a1",
      "name": "Simple Vector Store"
    },
    {
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "typeVersion": 1,
      "position": [
        400,
        432
      ],
      "id": "a3f60029-5394-470b-bc6d-ede67e699c42",
      "name": "Embeddings Ollama",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "insert",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.3,
      "position": [
        1568,
        -32
      ],
      "id": "a84ba7bb-48e1-4ebc-83c3-a072a9afba32",
      "name": "Simple Vector Store1"
    },
    {
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "typeVersion": 1,
      "position": [
        1232,
        240
      ],
      "id": "2aff6c48-57ea-471a-8d71-5e61a3551faf",
      "name": "Embeddings Ollama1",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chunkOverlap": 200,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        1440,
        480
      ],
      "id": "c45c5f08-fe6f-4aee-8a90-01edba9d80dc",
      "name": "Recursive Character Text Splitter"
    },
    {
      "parameters": {
        "fileSelector": "C:\\Users\\Jardiel\\.n8n-files\\the-beauty-geeks-guide-to-skin-care-1000-essential-definitions-of-common-product-ingredients-9781641523592-9781641523608_compress.pdf",
        "options": {}
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1.1,
      "position": [
        1024,
        -128
      ],
      "id": "f29c1186-b5b4-4de1-80e7-81b8a5dec761",
      "name": "Read/Write Files from Disk"
    },
    {
      "parameters": {
        "textSplittingMode": "custom",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        1440,
        256
      ],
      "id": "50788475-0c3f-4382-aaca-40a05a724e8a",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        576,
        0
      ],
      "id": "a2e656ed-6b8d-4f37-87dc-d4ea77a4d3d4",
      "name": "Send a text message",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "pdf",
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1.1,
      "position": [
        1360,
        -192
      ],
      "id": "eff29dc3-3a92-414f-b369-10d424ca7347",
      "name": "Extract from File"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.message.chat.id }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.4,
      "position": [
        528,
        496
      ],
      "id": "bb98e427-6f5f-4fe5-bfe7-909a853035e8",
      "name": "Simple Memory"
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Vector Store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Ollama": {
      "ai_embedding": [
        [
          {
            "node": "Simple Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Ollama1": {
      "ai_embedding": [
        [
          {
            "node": "Simple Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Simple Vector Store1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Simple Vector Store1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "9de49502-c04c-4776-9987-0e20e6506e90",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "AasE662qQY088pJf",
  "tags": []
}