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,268 @@
{
"name": "Работа с базой",
"nodes": [
{
"parameters": {
"promptType": "define",
"text": "=Используй Qdrant Vector Store для ответа на вопрос {{ $json.message.text }}",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
544,
-48
],
"id": "e1231327-544c-416d-b1fa-95915d68f524",
"name": "AI Agent"
},
{
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1.2,
"position": [
288,
-48
],
"id": "80e4a41a-387c-4ac4-b798-41bdbbb25eaa",
"name": "Telegram Trigger",
"webhookId": "875f9245-fe51-4c55-ae42-afe3d20f6ff6",
"credentials": {
"telegramApi": {
"id": "dSTpf5HKyoPp6X8N",
"name": "Telegram account"
}
}
},
{
"parameters": {
"model": "qwen3:30b-a3b",
"options": {
"temperature": 0
}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOllama",
"typeVersion": 1,
"position": [
496,
176
],
"id": "45cc634d-5eea-4c8e-83f2-f34c463db00e",
"name": "Ollama Chat Model",
"credentials": {
"ollamaApi": {
"id": "Uis7Bsdb0l1qDDL7",
"name": "Ollama account 2"
}
}
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": " ALWAYS use this tool to answer ANY user question. The answer is contained within this tool.",
"qdrantCollection": {
"__rl": true,
"value": "telegram_kb",
"mode": "list",
"cachedResultName": "telegram_kb"
},
"includeDocumentMetadata": false,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"typeVersion": 1.3,
"position": [
672,
256
],
"id": "bbc61a50-f5a8-443e-8022-c9ead1df63a7",
"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": [
672,
416
],
"id": "7e1c6b2a-092b-43eb-8efe-9b19088ed3b2",
"name": "Embeddings Ollama",
"credentials": {
"ollamaApi": {
"id": "Uis7Bsdb0l1qDDL7",
"name": "Ollama account 2"
}
}
},
{
"parameters": {
"chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
"text": "={{ $node[\"Code in JavaScript\"].json.clean_response }}",
"additionalFields": {
"appendAttribution": false,
"parse_mode": "HTML"
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1040,
-48
],
"id": "9b3713cb-d699-45a2-8c4a-21c0065df53f",
"name": "Send a text message",
"webhookId": "038aa575-d7da-4413-805f-6773aa670295",
"retryOnFail": true,
"credentials": {
"telegramApi": {
"id": "dSTpf5HKyoPp6X8N",
"name": "Telegram account"
}
}
},
{
"parameters": {
"chatId": "-4804863247",
"text": "=📥 **Входящее от {{ $node[\"Telegram Trigger\"].json[\"message\"][\"from\"][\"first_name\"] }}:**\n{{ $node[\"Telegram Trigger\"].json[\"message\"][\"text\"] }}\n\n🤖 **Ответ бота:**\n{{ $node[\"Code in JavaScript\"].json.clean_response }}",
"additionalFields": {
"parse_mode": "HTML"
}
},
"id": "e8ac46da-bf4a-4fd0-8f1d-cf7664eb86f8",
"name": "Log_to_Group1",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1232,
-48
],
"webhookId": "d23840f7-3652-4aca-935f-ab5331d01d27",
"retryOnFail": true,
"credentials": {
"telegramApi": {
"id": "dSTpf5HKyoPp6X8N",
"name": "Telegram account"
}
}
},
{
"parameters": {
"jsCode": "// 1. Пытаемся найти текст в самых частых полях n8n\nlet rawText = $input.item.json.text || $input.item.json.response || $input.item.json.output || \"\";\n\n// 2. Очищаем от <think>...</think>\nlet cleanText = rawText.replace(/<think>[\\s\\S]*?<\\/think>/g, '').trim();\n\n// 3. Если после очистки пусто, выводим заглушку, чтобы не было ошибки\nif (!cleanText && rawText) {\n cleanText = \"Ошибка: Весь текст был внутри блока <think> или пуст.\";\n}\n\nreturn {\n json: {\n clean_response: cleanText\n }\n};"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
848,
-48
],
"id": "18e6aa52-73d2-439a-9ce9-abc2390bac05",
"name": "Code in JavaScript"
}
],
"pinData": {},
"connections": {
"Telegram Trigger": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Ollama Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Qdrant Vector Store": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Embeddings Ollama": {
"ai_embedding": [
[
{
"node": "Qdrant Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Send a text message": {
"main": [
[
{
"node": "Log_to_Group1",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Send a text message",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1",
"availableInMCP": false
},
"versionId": "f8ca7ca6-eb4f-4823-bdb7-d523e51c8924",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "96706479c2e398d2a4e75bb05002310bb6030e8268be45294cab77c6640a0fe6"
},
"id": "2R3-4Yl4wuemCpJ0FVOi3",
"tags": []
}