Initial project setup for Telegram-to-Qdrant knowledge base.

Add unified n8n workflow, userbot ingestion script, and detailed README for running n8n with a separate Dockerized Telethon collector.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-23 20:20:56 +03:00
commit a8d634f422
13 changed files with 1768 additions and 0 deletions

View File

@@ -0,0 +1,178 @@
{
"name": "Создание базы (TG Text)",
"nodes": [
{
"parameters": {
"mode": "insert",
"qdrantCollection": {
"__rl": true,
"value": "=11111",
"mode": "id"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"typeVersion": 1.3,
"position": [
112,
-208
],
"id": "44a1fb40-5b1f-401a-9fea-ca61f111d2ca",
"name": "Qdrant Vector Store",
"credentials": {
"qdrantApi": {
"id": "gS1LJOMgnR7VJFRO",
"name": "QdrantApi account 2"
}
}
},
{
"parameters": {
"model": "qwen3-embedding:8b"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"typeVersion": 1,
"position": [
32,
0
],
"id": "7448ed28-7971-4d95-b073-1251dfff242e",
"name": "Embeddings Ollama",
"credentials": {
"ollamaApi": {
"id": "XVSCsyxx8Z57lSRa",
"name": "Ollama account 3"
}
}
},
{
"parameters": {
"chunkSize": 500,
"chunkOverlap": 50
},
"type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
"typeVersion": 1,
"position": [
272,
192
],
"id": "aed6ea3c-ad56-432b-8ef5-823a7778da27",
"name": "Character Text Splitter"
},
{
"parameters": {
"httpMethod": "POST",
"path": "tg-inbox",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-448,
-208
],
"id": "1770ab28-9cfa-4bc8-864a-fe793f1b95db",
"name": "Webhook",
"webhookId": "d857e864-ed25-447f-84ef-27c63190fb93",
"notesInFlow": false
},
{
"parameters": {
"textSplittingMode": "custom",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"typeVersion": 1.1,
"position": [
272,
0
],
"id": "6c98f0d9-97c1-4d94-bdea-a1941fd7d3f8",
"name": "Default Data Loader"
},
{
"parameters": {
"jsCode": "// В n8n данные из POST запроса всегда лежат в объекте body\nconst msg = $input.item.json.body;\n\n// 1. Берем текст\nconst rawText = msg.text || \"\"; \n\n// 2. Достаем метаданные из объекта metadata, который прислал Python\nconst meta = msg.metadata || {};\n\n// 3. Извлекаем имя и ID из объекта metadata\nconst senderName = meta.sender_name || \"Unknown\";\nconst senderId = meta.sender_id || \"0\";\n\n// 4. Формируем результат для Qdrant\nreturn {\n json: {\n content: `Пользователь ${senderName} (ID: ${senderId}) написал: ${rawText}`,\n metadata: {\n ...meta, // Копируем всю метадату (date, message_id, group_id и т.д.)\n sender_name: senderName,\n sender_id: senderId,\n original_text: rawText\n }\n }\n};\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-192,
-208
],
"id": "0ff56c0f-9208-4ae9-920c-4332c09f6df4",
"name": "Code in JavaScript"
}
],
"pinData": {},
"connections": {
"Webhook": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Embeddings Ollama": {
"ai_embedding": [
[
{
"node": "Qdrant Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Qdrant Vector Store",
"type": "ai_document",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Qdrant Vector Store",
"type": "main",
"index": 0
}
]
]
},
"Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"availableInMCP": false
},
"versionId": "f5079d8e-590c-4db5-988a-3fe709346a4a",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "96706479c2e398d2a4e75bb05002310bb6030e8268be45294cab77c6640a0fe6"
},
"id": "QpXms3TNMSqlQD2ULX3WO",
"tags": []
}