323 lines
12 KiB
JSON
323 lines
12 KiB
JSON
{
|
|
"name": "RAG KI-Bot (PGVector)",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"public": true,
|
|
"initialMessages": "Hallo! 👋\nMein Name ist Clara (Customer Learning & Answering Reference Assistant)\nWie kann ich behilflich sein?",
|
|
"options": {
|
|
"inputPlaceholder": "Hier die Frage eingeben...",
|
|
"showWelcomeScreen": true,
|
|
"subtitle": "Die Antworten der AI können fehlerhaft sein.",
|
|
"title": "Support-Chat 👋",
|
|
"customCss": ":root {\n /* Colors */\n --chat--color-primary: #e74266;\n --chat--color-primary-shade-50: #db4061;\n --chat--color-primary-shade-100: #cf3c5c;\n --chat--color-secondary: #20b69e;\n --chat--color-secondary-shade-50: #1ca08a;\n --chat--color-white: #ffffff;\n --chat--color-light: #f2f4f8;\n --chat--color-light-shade-50: #e6e9f1;\n --chat--color-light-shade-100: #c2c5cc;\n --chat--color-medium: #d2d4d9;\n --chat--color-dark: #101330;\n --chat--color-disabled: #d2d4d9;\n --chat--color-typing: #404040;\n\n /* Base Layout */\n --chat--spacing: 1rem;\n --chat--border-radius: 0.25rem;\n --chat--transition-duration: 0.15s;\n --chat--font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\n\n /* Window Dimensions */\n --chat--window--width: 400px;\n --chat--window--height: 600px;\n --chat--window--bottom: var(--chat--spacing);\n --chat--window--right: var(--chat--spacing);\n --chat--window--z-index: 9999;\n --chat--window--border: 1px solid var(--chat--color-light-shade-50);\n --chat--window--border-radius: var(--chat--border-radius);\n --chat--window--margin-bottom: var(--chat--spacing);\n\n /* Header Styles */\n --chat--header-height: auto;\n --chat--header--padding: var(--chat--spacing);\n --chat--header--background: var(--chat--color-dark);\n --chat--header--color: var(--chat--color-light);\n --chat--header--border-top: none;\n --chat--header--border-bottom: none;\n --chat--header--border-left: none;\n --chat--header--border-right: none;\n --chat--heading--font-size: 2em;\n --chat--subtitle--font-size: inherit;\n --chat--subtitle--line-height: 1.8;\n\n /* Message Styles */\n --chat--message--font-size: 1rem;\n --chat--message--padding: var(--chat--spacing);\n --chat--message--border-radius: var(--chat--border-radius);\n --chat--message-line-height: 1.5;\n --chat--message--margin-bottom: calc(var(--chat--spacing) * 1);\n --chat--message--bot--background: var(--chat--color-white);\n --chat--message--bot--color: var(--chat--color-dark);\n --chat--message--bot--border: none;\n --chat--message--user--background: var(--chat--color-secondary);\n --chat--message--user--color: var(--chat--color-white);\n --chat--message--user--border: none;\n --chat--message--pre--background: rgba(0, 0, 0, 0.05);\n --chat--messages-list--padding: var(--chat--spacing);\n\n /* Toggle Button */\n --chat--toggle--size: 64px;\n --chat--toggle--width: var(--chat--toggle--size);\n --chat--toggle--height: var(--chat--toggle--size);\n --chat--toggle--border-radius: 50%;\n --chat--toggle--background: var(--chat--color-primary);\n --chat--toggle--hover--background: var(--chat--color-primary-shade-50);\n --chat--toggle--active--background: var(--chat--color-primary-shade-100);\n --chat--toggle--color: var(--chat--color-white);\n\n /* Input Area */\n --chat--textarea--height: 50px;\n --chat--textarea--max-height: 30rem;\n --chat--input--font-size: inherit;\n --chat--input--border: 0;\n --chat--input--border-radius: 0;\n --chat--input--padding: 0.8rem;\n --chat--input--background: var(--chat--color-white);\n --chat--input--text-color: initial;\n --chat--input--line-height: 1.5;\n --chat--input--placeholder--font-size: var(--chat--input--font-size);\n --chat--input--border-active: 0;\n --chat--input--left--panel--width: 2rem;\n\n /* Button Styles */\n --chat--button--color: var(--chat--color-light);\n --chat--button--background: var(--chat--color-primary);\n --chat--button--padding: calc(var(--chat--spacing) * 1 / 2) var(--chat--spacing);\n --chat--button--border-radius: var(--chat--border-radius);\n --chat--button--hover--color: var(--chat--color-light);\n --chat--button--hover--background: var(--chat--color-primary-shade-50);\n --chat--close--button--color-hover: var(--chat--color-primary);\n\n /* Send and File Buttons */\n --chat--input--send--button--background: var(--chat--color-white);\n --chat--input--send--button--color: var(--chat--color-secondary);\n --chat--input--send--button--background-hover: var(--chat--color-primary-shade-50);\n --chat--input--send--button--color-hover: var(--chat--color-secondary-shade-50);\n --chat--input--file--button--background: var(--chat--color-white);\n --chat--input--file--button--color: var(--chat--color-secondary);\n --chat--input--file--button--background-hover: var(--chat--input--file--button--background);\n --chat--input--file--button--color-hover: var(--chat--color-secondary-shade-50);\n --chat--files-spacing: 0.25rem;\n\n /* Body and Footer */\n --chat--body--background: var(--chat--color-light);\n --chat--footer--background: var(--chat--color-light);\n --chat--footer--color: var(--chat--color-dark);\n}\n\n\n/* You can override any class styles, too. Right-click inspect in Chat UI to find class to override. */\n.chat-message {\n\tmax-width: 50%;\n}",
|
|
"responseMode": "lastNode"
|
|
}
|
|
},
|
|
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
|
|
"typeVersion": 1.3,
|
|
"position": [
|
|
0,
|
|
0
|
|
],
|
|
"id": "chat-trigger-001",
|
|
"name": "When chat message received",
|
|
"webhookId": "rag-chat-webhook",
|
|
"notesInFlow": true,
|
|
"notes": "Chat URL: /webhook/rag-chat-webhook/chat"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"promptType": "define",
|
|
"text": "={{ $json.chatInput }}\nAntworte ausschliesslich auf Deutsch und nutze zuerst die Wissensdatenbank.",
|
|
"options": {}
|
|
},
|
|
"type": "@n8n/n8n-nodes-langchain.agent",
|
|
"typeVersion": 2.2,
|
|
"position": [
|
|
208,
|
|
0
|
|
],
|
|
"id": "ai-agent-001",
|
|
"name": "AI Agent"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"model": "ministral-3:3b",
|
|
"options": {}
|
|
},
|
|
"type": "@n8n/n8n-nodes-langchain.lmChatOllama",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
64,
|
|
208
|
|
],
|
|
"id": "ollama-chat-001",
|
|
"name": "Ollama Chat Model",
|
|
"credentials": {
|
|
"ollamaApi": {
|
|
"id": "ZmMYzkrY4zMFYJ1J",
|
|
"name": "Ollama (local)"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {},
|
|
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
|
"typeVersion": 1.3,
|
|
"position": [
|
|
224,
|
|
208
|
|
],
|
|
"id": "memory-001",
|
|
"name": "Simple Memory"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "retrieve-as-tool",
|
|
"toolName": "knowledge_base",
|
|
"toolDescription": "Verwende dieses Tool für Infos die der Benutzer fragt. Sucht in der Wissensdatenbank nach relevanten Dokumenten.",
|
|
"tableName": "documents",
|
|
"options": {}
|
|
},
|
|
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
432,
|
|
128
|
|
],
|
|
"id": "pgvector-retrieve-001",
|
|
"name": "PGVector Store",
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "1VVtY5ei866suQdA",
|
|
"name": "PostgreSQL (local)"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"model": "nomic-embed-text:latest"
|
|
},
|
|
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
416,
|
|
288
|
|
],
|
|
"id": "embeddings-retrieve-001",
|
|
"name": "Embeddings Ollama",
|
|
"credentials": {
|
|
"ollamaApi": {
|
|
"id": "ZmMYzkrY4zMFYJ1J",
|
|
"name": "Ollama (local)"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"formTitle": "Dokument hochladen",
|
|
"formDescription": "Laden Sie ein PDF-Dokument hoch, um es in die Wissensdatenbank aufzunehmen.",
|
|
"formFields": {
|
|
"values": [
|
|
{
|
|
"fieldLabel": "Dokument",
|
|
"fieldType": "file",
|
|
"acceptFileTypes": ".pdf"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.formTrigger",
|
|
"typeVersion": 2.3,
|
|
"position": [
|
|
768,
|
|
0
|
|
],
|
|
"id": "form-trigger-001",
|
|
"name": "On form submission",
|
|
"webhookId": "rag-upload-form"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"operation": "pdf",
|
|
"binaryPropertyName": "Dokument",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.extractFromFile",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
976,
|
|
0
|
|
],
|
|
"id": "extract-file-001",
|
|
"name": "Extract from File"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "insert",
|
|
"tableName": "documents",
|
|
"options": {}
|
|
},
|
|
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
1184,
|
|
0
|
|
],
|
|
"id": "pgvector-insert-001",
|
|
"name": "PGVector Store Insert",
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "1VVtY5ei866suQdA",
|
|
"name": "PostgreSQL (local)"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"model": "nomic-embed-text:latest"
|
|
},
|
|
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
1168,
|
|
240
|
|
],
|
|
"id": "embeddings-insert-001",
|
|
"name": "Embeddings Ollama1",
|
|
"credentials": {
|
|
"ollamaApi": {
|
|
"id": "ZmMYzkrY4zMFYJ1J",
|
|
"name": "Ollama (local)"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"options": {}
|
|
},
|
|
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
|
"typeVersion": 1.1,
|
|
"position": [
|
|
1392,
|
|
240
|
|
],
|
|
"id": "data-loader-001",
|
|
"name": "Default Data Loader"
|
|
}
|
|
],
|
|
"pinData": {},
|
|
"connections": {
|
|
"When chat message received": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "AI Agent",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Ollama Chat Model": {
|
|
"ai_languageModel": [
|
|
[
|
|
{
|
|
"node": "AI Agent",
|
|
"type": "ai_languageModel",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Simple Memory": {
|
|
"ai_memory": [
|
|
[
|
|
{
|
|
"node": "AI Agent",
|
|
"type": "ai_memory",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"PGVector Store": {
|
|
"ai_tool": [
|
|
[
|
|
{
|
|
"node": "AI Agent",
|
|
"type": "ai_tool",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Embeddings Ollama": {
|
|
"ai_embedding": [
|
|
[
|
|
{
|
|
"node": "PGVector Store",
|
|
"type": "ai_embedding",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"On form submission": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Extract from File",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Extract from File": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "PGVector Store Insert",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Embeddings Ollama1": {
|
|
"ai_embedding": [
|
|
[
|
|
{
|
|
"node": "PGVector Store Insert",
|
|
"type": "ai_embedding",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Default Data Loader": {
|
|
"ai_document": [
|
|
[
|
|
{
|
|
"node": "PGVector Store Insert",
|
|
"type": "ai_document",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"active": true,
|
|
"settings": {
|
|
"executionOrder": "v1"
|
|
},
|
|
"versionId": "6ebf0ac8-b8ab-49ee-b6f1-df0b606b3a33",
|
|
"meta": {
|
|
"instanceId": "a2179cec0884855b4d650fea20868c0dbbb03f0d0054c803c700fff052afc74c"
|
|
},
|
|
"id": "Q9Bm63B9ae8rAj95",
|
|
"tags": []
|
|
} |