Sistema de Chat de Documentos Nextcloud basado en IA, usando LangChain y OpenAI
Este es unAI, IT Opsflujo de automatización del dominio deautomatización que contiene 21 nodos.Utiliza principalmente nodos como If, Set, Code, Switch, Aggregate, combinando tecnología de inteligencia artificial para lograr automatización inteligente. Sistema de Chat de Documentos Nextcloud basado en IA, usando LangChain y OpenAI
- •Clave de API de OpenAI
Nodos utilizados (21)
{
"meta": {
"instanceId": "634e789e9cac462123b2b4acaedfe20e105965d27f018a60d1d4305ae72b1acb"
},
"nodes": [
{
"id": "9745c907-14fe-49b8-9acf-b4e847bf2ebc",
"name": "Cuando se recibe mensaje de chat",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-1060,
-200
],
"webhookId": "42ca02f5-5d57-41aa-a8c7-34db652e2493",
"parameters": {
"public": true,
"options": {},
"initialMessages": "Hi there! 👋\nMy name is Johan. How can I assist you today?"
},
"typeVersion": 1.1
},
{
"id": "aa540b75-cb88-4f09-b76a-c1a66b2eb34b",
"name": "OpenAI Modelo de Chat",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-1000,
40
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "qwen3-235b-a22b",
"cachedResultName": "qwen3-235b-a22b"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "e3etpZ3VT4nd9brg",
"name": "gwdg api"
}
},
"typeVersion": 1.2
},
{
"id": "fcb5b3c9-c0d4-41b1-8f76-58c2bb1bf822",
"name": "Memoria Simple",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-840,
40
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "da680124-9c4e-4bb7-9d70-8ae0d5515bb0",
"name": "AI Nextcloud",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-860,
-200
],
"parameters": {
"options": {}
},
"typeVersion": 1.9
},
{
"id": "cce0ea8a-5bd1-48ad-9e2c-bca053755278",
"name": "Cuando se ejecuta por otro flujo de trabajo",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
-1620,
580
],
"parameters": {
"workflowInputs": {
"values": [
{
"name": "path"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "d382c346-4f35-4772-a3e3-2104be66ffce",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
-720,
500
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "pdf",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "902f5ebf-b91a-48d1-a1bf-9a46c98a0853",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.contentType }}",
"rightValue": "application/pdf"
}
]
},
"renameOutput": true
},
{
"outputKey": "md",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "8c48e515-832a-421c-8cde-7c1123c14467",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.contentType }}",
"rightValue": "text/markdown"
}
]
},
"renameOutput": true
},
{
"outputKey": "docx",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "044f36c5-5787-4308-9b49-8b28d0288649",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.contentType }}",
"rightValue": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "14addc84-0661-4913-bf6b-9870cce876bf",
"name": "Agregar",
"type": "n8n-nodes-base.aggregate",
"position": [
-60,
500
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "e7a14c39-5853-4e2f-8549-47917eedd3ac",
"name": "salida",
"type": "n8n-nodes-base.set",
"position": [
120,
500
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "0f77cdc0-3115-4abd-91aa-069a36b1a7ac",
"name": "output",
"type": "string",
"value": "={{ $json.data }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "dc6ee0ee-b2e8-433d-8acb-b182dc6e8529",
"name": "Nota adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1700,
260
],
"parameters": {
"color": 6,
"width": 2080,
"height": 700,
"content": "# Subworkflow \n\n## Nextcloud\n\nList Files in a gigven path and returns Dile contents form docs\n\nRequired Community Node:\nhttps://www.npmjs.com/package/n8n-nodes-word2text\n"
},
"typeVersion": 1
},
{
"id": "858059e4-6a66-4442-8a04-d9cd4fd6dcc0",
"name": "Si es legible",
"type": "n8n-nodes-base.if",
"position": [
-1120,
580
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "dcc91aaa-d9bb-4c11-88b7-c569f811ec1d",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.contentType }}",
"rightValue": "pdf"
},
{
"id": "b7695016-8a8d-460e-977e-f415443df1f2",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.contentType }}",
"rightValue": "markdown"
},
{
"id": "ca8021f0-a853-4a09-aee9-96494a66d131",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.contentType }}",
"rightValue": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "e3341daa-f89d-4666-848a-1dbcfb7a9f74",
"name": "Obtener archivos",
"type": "n8n-nodes-base.nextCloud",
"position": [
-1300,
580
],
"parameters": {
"path": "={{ $json.path }}",
"resource": "folder",
"operation": "list"
},
"credentials": {
"nextCloudApi": {
"id": "3nENap8sZI7MN816",
"name": "NextCloud account"
}
},
"typeVersion": 1
},
{
"id": "23d1168d-c0f1-412c-bfe2-fc229cd0567a",
"name": "Descargar archivo",
"type": "n8n-nodes-base.nextCloud",
"position": [
-900,
500
],
"parameters": {
"path": "={{ $json.path.urlDecode() }}",
"operation": "download"
},
"credentials": {
"nextCloudApi": {
"id": "3nENap8sZI7MN816",
"name": "NextCloud account"
}
},
"typeVersion": 1
},
{
"id": "9aaeb43a-6156-4c72-a090-9eb07fb2a85c",
"name": "añadir ruta 1",
"type": "n8n-nodes-base.code",
"position": [
-320,
300
],
"parameters": {
"jsCode": "for (const item of $input.all()) {\n item.json.path = $('Switch').first().json.path;\n}\n\nreturn $input.all();"
},
"typeVersion": 2
},
{
"id": "fe21734c-e0e5-43f3-8bb9-4fd976ab61a9",
"name": "añadir ruta 2",
"type": "n8n-nodes-base.code",
"position": [
-320,
500
],
"parameters": {
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n item.json.path = $('Switch').first().json.path;\n}\n\nreturn $input.all();"
},
"typeVersion": 2
},
{
"id": "46bb7f6b-7a0d-4761-b50b-50ed8a0fd01a",
"name": "añadir ruta 3",
"type": "n8n-nodes-base.code",
"position": [
-320,
720
],
"parameters": {
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n item.json.path = $('Switch').first().json.path;\n}\n\nreturn $input.all();"
},
"typeVersion": 2
},
{
"id": "6124f284-2846-4c88-b075-2a2fec028664",
"name": "datos de prueba",
"type": "n8n-nodes-base.code",
"position": [
-1460,
580
],
"parameters": {
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n item.json.path = item.json.path || '/test/folder';\n}\n\nreturn $input.all();"
},
"typeVersion": 2
},
{
"id": "7b11ef64-3887-4baa-a8ca-3c76c8f4eb02",
"name": "Herramienta Nextcloud",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
-700,
40
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "list",
"value": "fni6RBWYOcTGA0tT",
"cachedResultName": "nextcloud-folder"
},
"description": "Call this tool to read files from a folder (in Nextcloud). Pass the folder path as a parameter.",
"workflowInputs": {
"value": {
"path": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('path', ``, 'string') }}"
},
"schema": [
{
"id": "path",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "path",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"path"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "c78d765f-b6fe-40bb-9245-3ce50cb009b4",
"name": "Nota adhesiva 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1700,
-260
],
"parameters": {
"width": 1260,
"height": 460,
"content": "# Main Workflow\n\n## AI Agent\n\nAnswers question to folder contents. \n\nPut the Path to the folder into your question."
},
"typeVersion": 1
},
{
"id": "147fe75b-022f-4fb0-8259-bc91286f54ca",
"name": "PDF",
"type": "n8n-nodes-base.extractFromFile",
"position": [
-500,
300
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "1bd71897-738a-46a2-b7e3-700e4ad9db8f",
"name": "Markdown",
"type": "n8n-nodes-base.extractFromFile",
"position": [
-500,
500
],
"parameters": {
"options": {},
"operation": "text",
"destinationKey": "text"
},
"typeVersion": 1
},
{
"id": "9ed19c46-55aa-4109-85c7-a8b9cf068568",
"name": "DOCX",
"type": "n8n-nodes-word2text.word2text",
"position": [
-500,
740
],
"parameters": {},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"147fe75b-022f-4fb0-8259-bc91286f54ca": {
"main": [
[
{
"node": "9aaeb43a-6156-4c72-a090-9eb07fb2a85c",
"type": "main",
"index": 0
}
]
]
},
"9ed19c46-55aa-4109-85c7-a8b9cf068568": {
"main": [
[
{
"node": "46bb7f6b-7a0d-4761-b50b-50ed8a0fd01a",
"type": "main",
"index": 0
}
]
]
},
"d382c346-4f35-4772-a3e3-2104be66ffce": {
"main": [
[
{
"node": "147fe75b-022f-4fb0-8259-bc91286f54ca",
"type": "main",
"index": 0
}
],
[
{
"node": "1bd71897-738a-46a2-b7e3-700e4ad9db8f",
"type": "main",
"index": 0
}
],
[
{
"node": "9ed19c46-55aa-4109-85c7-a8b9cf068568",
"type": "main",
"index": 0
}
]
]
},
"1bd71897-738a-46a2-b7e3-700e4ad9db8f": {
"main": [
[
{
"node": "fe21734c-e0e5-43f3-8bb9-4fd976ab61a9",
"type": "main",
"index": 0
}
]
]
},
"14addc84-0661-4913-bf6b-9870cce876bf": {
"main": [
[
{
"node": "e7a14c39-5853-4e2f-8549-47917eedd3ac",
"type": "main",
"index": 0
}
]
]
},
"e3341daa-f89d-4666-848a-1dbcfb7a9f74": {
"main": [
[
{
"node": "858059e4-6a66-4442-8a04-d9cd4fd6dcc0",
"type": "main",
"index": 0
}
]
]
},
"6124f284-2846-4c88-b075-2a2fec028664": {
"main": [
[
{
"node": "e3341daa-f89d-4666-848a-1dbcfb7a9f74",
"type": "main",
"index": 0
}
]
]
},
"9aaeb43a-6156-4c72-a090-9eb07fb2a85c": {
"main": [
[
{
"node": "14addc84-0661-4913-bf6b-9870cce876bf",
"type": "main",
"index": 0
}
]
]
},
"fe21734c-e0e5-43f3-8bb9-4fd976ab61a9": {
"main": [
[
{
"node": "14addc84-0661-4913-bf6b-9870cce876bf",
"type": "main",
"index": 0
}
]
]
},
"46bb7f6b-7a0d-4761-b50b-50ed8a0fd01a": {
"main": [
[
{
"node": "14addc84-0661-4913-bf6b-9870cce876bf",
"type": "main",
"index": 0
}
]
]
},
"858059e4-6a66-4442-8a04-d9cd4fd6dcc0": {
"main": [
[
{
"node": "23d1168d-c0f1-412c-bfe2-fc229cd0567a",
"type": "main",
"index": 0
}
]
]
},
"23d1168d-c0f1-412c-bfe2-fc229cd0567a": {
"main": [
[
{
"node": "d382c346-4f35-4772-a3e3-2104be66ffce",
"type": "main",
"index": 0
}
]
]
},
"fcb5b3c9-c0d4-41b1-8f76-58c2bb1bf822": {
"ai_memory": [
[
{
"node": "da680124-9c4e-4bb7-9d70-8ae0d5515bb0",
"type": "ai_memory",
"index": 0
}
]
]
},
"7b11ef64-3887-4baa-a8ca-3c76c8f4eb02": {
"ai_tool": [
[
{
"node": "da680124-9c4e-4bb7-9d70-8ae0d5515bb0",
"type": "ai_tool",
"index": 0
}
]
]
},
"aa540b75-cb88-4f09-b76a-c1a66b2eb34b": {
"ai_languageModel": [
[
{
"node": "da680124-9c4e-4bb7-9d70-8ae0d5515bb0",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"9745c907-14fe-49b8-9acf-b4e847bf2ebc": {
"main": [
[
{
"node": "da680124-9c4e-4bb7-9d70-8ae0d5515bb0",
"type": "main",
"index": 0
}
]
]
},
"cce0ea8a-5bd1-48ad-9e2c-bca053755278": {
"main": [
[
{
"node": "6124f284-2846-4c88-b075-2a2fec028664",
"type": "main",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Avanzado - Inteligencia Artificial, Operaciones de TI
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
johappel
@johappelCompartir este flujo de trabajo