Restore from Gitea ZIP snapshot (12.08.2026) after full instance reinstall

Git history was lost when the previous Gitea instance was wiped and
reinstalled due to an unresolved corruption bug — this commit is the
last known-good file content, exported before the reinstall. Prior
commit history is not recoverable through this path.
This commit is contained in:
Claude Sonnet 5 committed 2026-08-12 19:23:56 +00:00
commit e148cd9218
24 files changed
+24

No files matched your search

@@ -0,0 +1 @@
{"updatedAt":"2025-12-03T08:57:06.038Z","createdAt":"2025-12-03T08:27:21.172Z","id":"0J4i0Xlku6iq8SrC","name":"AI Assistant which answers questions with a RAG MCP and a Search Engine MCP","active":false,"isArchived":true,"nodes":[{"parameters":{"options":{"systemMessage":"You are a helpful assistant\n\nYou answer questions about MCP (Model Context Protocol). You have access to two MCP servers:\n\n- The RAG MCP Server which answers general questions about MCP\n- The Search Engine MCP Server which allows you to use a Search Engine in realtime.\n\nThe Search Engine MCP Server has two tools;\n- list tool - which shows all the available tools\n- execute tool - which allows you to execute a search query on a search engine.\n\nYou DO NOT answer questions with your internal knowledge, you ONLY use the knowledge provided by the two MCP servers to answer questions."}},"id":"7d21346c-f225-4cc8-85d6-6dd68fc9a035","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[592,240],"typeVersion":2},{"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1-mini"},"options":{}},"id":"ab24be4f-acbd-47b9-abe1-1db621150971","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[352,528],"typeVersion":1.2,"credentials":{"openAiApi":{"id":"PvUURuR361IXH0ve","name":"OpenAi account"}}},{"parameters":{"contextWindowLength":15},"id":"71e5008a-2e56-4588-a4c3-a8724026b998","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[560,528],"typeVersion":1.3},{"parameters":{},"id":"aa1ae334-de5d-4cd3-a4a5-60f48ca37bbe","name":"MCP_Search_List_Tools","type":"n8n-nodes-mcp.mcpClientTool","position":[1040,528],"typeVersion":1},{"parameters":{"content":"## RAG MCP Server","height":220,"width":280,"color":3},"id":"cef78817-9d96-4e16-80d1-6c8a2e7b574b","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[688,464],"typeVersion":1},{"parameters":{"content":"## Search Engine MCP Server","height":220,"width":360,"color":5},"id":"62d8bad6-50f4-4eec-b553-2107c7e5ee28","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[992,464],"typeVersion":1},{"parameters":{"operation":"executeTool","toolName":"search_engine","toolParameters":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', ``, 'json') }}"},"id":"4522cb25-9a05-4509-a3cb-0f4275c95bb3","name":"MCP_Search_Search_Engine","type":"n8n-nodes-mcp.mcpClientTool","position":[1232,528],"typeVersion":1},{"parameters":{"sseEndpoint":"http://localhost:5678/mcp/f88b9b77-40f2-4fad-8e14-0fc7faed7a0b","options":{}},"id":"e96335a9-cc8a-4d29-85d2-905321fba47c","name":"RAG MCP Server","type":"@n8n/n8n-nodes-langchain.mcpClientTool","position":[800,528],"typeVersion":1},{"parameters":{},"id":"76531f2c-8f92-455f-a618-8fc1dd579d03","name":"MCP Client","type":"n8n-nodes-mcp.mcpClientTool","position":[1024,192],"typeVersion":1},{"parameters":{"updates":["message"],"additionalFields":{}},"type":"n8n-nodes-base.telegramTrigger","typeVersion":1.2,"position":[336,240],"id":"8ec4db09-107a-4501-b70e-8c1e030a4992","name":"Telegram Trigger","webhookId":"dc3bef1c-7eef-4572-85dc-b835d0b96a8f","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}}],"connections":{"MCP Client":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"RAG MCP Server":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"MCP_Search_List_Tools":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"MCP_Search_Search_Engine":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Telegram Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]}},"settings":{},"staticData":null,"meta":{"templateId":"5398"},"pinData":{},"versionId":"6e9b526a-8d62-44d8-b2fa-2b66cfd11cb8","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-12-03T08:27:21.172Z","createdAt":"2025-12-03T08:27:21.172Z","role":"workflow:owner","workflowId":"0J4i0Xlku6iq8SrC","projectId":"sYuiFAb87pAir6jV"}],"activeVersion":null,"tags":[]}
@@ -0,0 +1 @@
{"updatedAt":"2025-12-18T05:21:02.386Z","createdAt":"2025-12-17T13:52:45.901Z","id":"NKZb0GpHbd8mQkIW","name":"MikroTik Universal (No DB)","active":false,"isArchived":false,"nodes":[{"parameters":{"updates":["message","callback_query"],"additionalFields":{}},"id":"864c89ee-e30e-4c15-9d0a-c53555f4e279","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1,"position":[-1296,112],"webhookId":"b396e51b-6ec0-4eca-b8cb-a3ed23b4ff56","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"chatId":"={{ $('Logic').item.json.chatId }}","text":"📋 Выберите адрес-лист:","replyMarkup":"inlineKeyboard","inlineKeyboard":{"rows":[{"row":{"buttons":[{"text":"don't touch","additionalFields":{"callback_data":"sl|don't touch"}},{"text":"rdp_ts","additionalFields":{"callback_data":"sl|rdp_ts"}},{"text":"rdp_ts02","additionalFields":{"callback_data":"sl|rdp_ts02"}}]}},{"row":{"buttons":[{"text":"rdp_ts01srv","additionalFields":{"callback_data":"sl|rdp_ts01srv"}},{"text":"rdp_ts02srv","additionalFields":{"callback_data":"sl|rdp_ts02srv"}}]}}]},"additionalFields":{}},"id":"e32aa69f-6402-4a9d-9589-af76f74f01f9","name":"Msg: Ask List","type":"n8n-nodes-base.telegram","typeVersion":1,"position":[352,-192],"webhookId":"6b2e2622-087e-4f97-914a-ef61b33a3054","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"operation":"upsert","dataTableId":{"__rl":true,"value":"LwB8m7fQUDgXiNuT","mode":"list","cachedResultName":"mikrotik_sessions","cachedResultUrl":"/projects/sYuiFAb87pAir6jV/datatables/LwB8m7fQUDgXiNuT"},"filters":{"conditions":[{"keyName":"chat_id","keyValue":"={{ $('Logic').item.json.chatId }}"}]},"columns":{"mappingMode":"defineBelow","value":{"list":"={{ $('Logic').item.json.list }}"},"matchingColumns":[],"schema":[{"id":"chat_id","displayName":"chat_id","required":false,"defaultMatch":false,"display":true,"type":"string","readOnly":false,"removed":true},{"id":"ip","displayName":"ip","required":false,"defaultMatch":false,"display":true,"type":"string","readOnly":false,"removed":true},{"id":"list","displayName":"list","required":false,"defaultMatch":false,"display":true,"type":"string","readOnly":false,"removed":false},{"id":"timeout","displayName":"timeout","required":false,"defaultMatch":false,"display":true,"type":"string","readOnly":false,"removed":true}],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{}},"type":"n8n-nodes-base.dataTable","typeVersion":1.1,"position":[-336,-32],"id":"dbeaa59d-ea63-44ba-a7c9-a89f8783dd53","name":"DB: Update List"},{"parameters":{"jsCode":"const input = $input.all()[0].json;\nlet chatId, text = '', cb = '';\nlet deleteMsgId = null; \n\n// Определяем, откуда пришел запрос (кнопка или текст)\nif (input.callback_query) {\n cb = input.callback_query.data || '';\n chatId = input.callback_query.message.chat.id;\n // Берем ID сообщения с кнопками (чтобы удалить меню)\n deleteMsgId = input.callback_query.message.message_id;\n} else if (input.message) {\n text = (input.message.text || '').trim();\n chatId = input.message.chat.id;\n // Берем ID сообщения пользователя (чтобы удалить его команду/текст)\n deleteMsgId = input.message.message_id;\n}\n\n// Функция для удобного ответа\nfunction respond(action, data = {}) {\n return [{\n json: {\n chatId,\n action,\n deleteMsgId, // Передаем ID сообщения дальше\n ...data\n }\n }];\n}\n\n// 1. Команды\nif (text === '/start' || text === '/menu') return respond('menu');\nif (text === '/addip') return respond('ask_ip');\nif (text === '/find') return respond('ask_search');\n\n// 2. Кнопки\nif (cb.startsWith('sl|')) return respond('save_list', { list: cb.split('|')[1] });\nif (cb.startsWith('st|')) return respond('save_time', { time: cb.split('|')[1] });\nif (cb.startsWith('to|') || cb.startsWith('del|')) return respond('check_state'); \n\n// 3. Текст (IP или Комментарий)\nif (text && !text.startsWith('/')) {\n if (/^\\d{1,3}(\\.\\d{1,3}){3}$/.test(text)) {\n return respond('save_ip', { ip: text });\n }\n return respond('save_comment', { comment: text });\n}\n\nreturn respond('menu');"},"id":"ab457912-85b4-4729-a8b0-e19e7f4d0bd9","name":"Logic","type":"n8n-nodes-base.code","typeVersion":2,"position":[-1088,112]},{"parameters":{"operation":"update","dataTableId":{"__rl":true,"value":"LwB8m7fQUDgXiNuT","mode":"list","cachedResultName":"mikrotik_sessions","cachedResultUrl":"/projects/sYuiFAb87pAir6jV/datatables/LwB8m7fQUDgXiNuT"},"filters":{"conditions":[{"keyName":"chat_id","keyValue":"={{ $('Logic').item.json.chatId }}"}]},"columns":{"mappingMode":"defineBelow","value":{"timeout":"={{ $('Logic').item.json.time }}"},"matchiLine truncated
@@ -0,0 +1 @@
{"updatedAt":"2025-12-26T11:49:46.960Z","createdAt":"2025-12-26T08:25:46.267Z","id":"sY0ddu-A-1P9TDZclJDPy","name":"MikroTik Universal (With Duplicate Check)","active":false,"isArchived":false,"nodes":[{"parameters":{"updates":["message","callback_query"],"additionalFields":{}},"id":"0ff5b511-c211-4eb9-b562-42b45c88f0df","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1,"position":[-1376,560],"webhookId":"b396e51b-6ec0-4eca-b8cb-a3ed23b4ff56","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"chatId":"={{ $('Logic').item.json.chatId }}","text":"📋 Выберите адрес-лист:","replyMarkup":"inlineKeyboard","inlineKeyboard":{"rows":[{"row":{"buttons":[{"text":"don't touch","additionalFields":{"callback_data":"sl|don't touch"}},{"text":"rdp_ts","additionalFields":{"callback_data":"sl|rdp_ts"}},{"text":"rdp_ts02","additionalFields":{"callback_data":"sl|rdp_ts02"}}]}},{"row":{"buttons":[{"text":"rdp_ts01srv","additionalFields":{"callback_data":"sl|rdp_ts01srv"}},{"text":"rdp_ts02srv","additionalFields":{"callback_data":"sl|rdp_ts02srv"}}]}}]},"additionalFields":{}},"id":"e22c5697-c8dc-4451-9a46-b2c5e2cfd081","name":"Msg: Ask List","type":"n8n-nodes-base.telegram","typeVersion":1,"position":[192,176],"webhookId":"6b2e2622-087e-4f97-914a-ef61b33a3054","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"operation":"upsert","dataTableId":{"__rl":true,"value":"LwB8m7fQUDgXiNuT","mode":"list","cachedResultName":"mikrotik_sessions","cachedResultUrl":"/projects/sYuiFAb87pAir6jV/datatables/LwB8m7fQUDgXiNuT"},"filters":{"conditions":[{"keyName":"chat_id","keyValue":"={{ $('Logic').item.json.chatId }}"}]},"columns":{"mappingMode":"defineBelow","value":{"list":"={{ $('Logic').item.json.list }}"},"matchingColumns":[],"schema":[{"id":"chat_id","displayName":"chat_id","required":false,"defaultMatch":false,"display":true,"type":"string","readOnly":false,"removed":true},{"id":"ip","displayName":"ip","required":false,"defaultMatch":false,"display":true,"type":"string","readOnly":false,"removed":true},{"id":"list","displayName":"list","required":false,"defaultMatch":false,"display":true,"type":"string","readOnly":false,"removed":false},{"id":"timeout","displayName":"timeout","required":false,"defaultMatch":false,"display":true,"type":"string","readOnly":false,"removed":true}],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{}},"type":"n8n-nodes-base.dataTable","typeVersion":1.1,"position":[-480,368],"id":"f17f5c31-3e05-4980-9242-7f663a781964","name":"DB: Update List"},{"parameters":{"jsCode":"const input = $input.all()[0].json;\nlet chatId, text = '', cb = '';\nlet deleteMsgId = null; \n\n// Определяем, откуда пришел запрос (кнопка или текст)\nif (input.callback_query) {\n cb = input.callback_query.data || '';\n chatId = input.callback_query.message.chat.id;\n // Берем ID сообщения с кнопками (чтобы удалить меню)\n deleteMsgId = input.callback_query.message.message_id;\n} else if (input.message) {\n text = (input.message.text || '').trim();\n chatId = input.message.chat.id;\n // Берем ID сообщения пользователя (чтобы удалить его команду/текст)\n deleteMsgId = input.message.message_id;\n}\n\n// Функция для удобного ответа\nfunction respond(action, data = {}) {\n return [{\n json: {\n chatId,\n action,\n deleteMsgId, // Передаем ID сообщения дальше\n ...data\n }\n }];\n}\n\n// 1. Команды\nif (text === '/start' || text === '/menu') return respond('menu');\nif (text === '/addip') return respond('ask_ip');\nif (text === '/find') return respond('ask_search');\n\n// 2. Кнопки\nif (cb.startsWith('sl|')) return respond('save_list', { list: cb.split('|')[1] });\nif (cb.startsWith('st|')) return respond('save_time', { time: cb.split('|')[1] });\nif (cb.startsWith('to|') || cb.startsWith('del|')) return respond('check_state'); \n\n// 3. Текст (IP или Комментарий)\nif (text && !text.startsWith('/')) {\n if (/^\\d{1,3}(\\.\\d{1,3}){3}$/.test(text)) {\n return respond('save_ip', { ip: text });\n }\n return respond('save_comment', { comment: text });\n}\n\nreturn respond('menu');"},"id":"a3e26177-3807-4a17-aafe-2dbb351b0cf1","name":"Logic","type":"n8n-nodes-base.code","typeVersion":2,"position":[-1152,560]},{"parameters":{"operation":"update","dataTableId":{"__rl":true,"value":"LwB8m7fQUDgXiNuT","mode":"list","cachedResultName":"mikrotik_sessions","cachedResultUrl":"/projects/sYuiFAb87pAir6jV/datatables/LwB8m7fQUDgXiNuT"},"filters":{"conditions":[{"keyName":"chat_id","keyValue":"={{ $('Logic').item.json.chatId }}"}]},"columns":{"mappingMode":"defineBelow","value":{"timeout":"={{ $('Logic').item.jsoLine truncated
@@ -0,0 +1 @@
{"updatedAt":"2025-12-08T20:59:27.678Z","createdAt":"2025-12-08T11:04:55.349Z","id":"WH2YAlOoEGwYhFVG","name":"MikroTik ↔ Telegram (Fixed Connections)","active":false,"isArchived":false,"nodes":[{"parameters":{"updates":["message","callback_query"],"additionalFields":{}},"name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1,"position":[-1840,32],"id":"0dcb4cd8-48b0-475a-a1e8-2c21f3276d28","webhookId":"10e7c043-bcbd-4b2c-9994-41b32ed03127","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"functionCode":"// === Получаем данные ===\nconst input = $input.all()[0].json;\nlet chatId, text = '', callbackData = '';\n\nif (input.callback_query) {\n callbackData = input.callback_query.data || '';\n chatId = input.callback_query.message.chat.id;\n} else if (input.message) {\n text = (input.message.text || '').trim();\n chatId = input.message.chat.id;\n}\n\n// === Меню ===\nif (text === '/menu' || text === '/start' || callbackData === 'menu') {\n return [{ json: { chatId, action: 'menu' } }];\n}\n\n// === Кнопки ===\nif (callbackData === 'add_ip') {\n return [{ json: { chatId, action: 'add_ip' } }];\n}\nif (callbackData === 'find_mode') {\n return [{ json: { chatId, action: 'find_mode' } }];\n}\n\n// === Перемещение и удаление ===\nif (callbackData.startsWith('to|') || callbackData.startsWith('del|')) {\n const parts = callbackData.split('|');\n const action = parts[0] === 'del' ? 'delete' : 'move';\n return [{ json: { chatId, entryId: parts[1], newList: parts[2], action } }];\n}\n\n// === КОМАНДА /addip (РАБОТАЕТ В ЛЮБОМ СЛУЧАЕ) ===\nif (text && text.toLowerCase().startsWith('/addip')) {\n const match = text.match(/\\/addip\\s+([\\d.]+)(?:\\s+([\\w-]+))?(?:\\s+([\\w\\d]+))?(?:\\s+\"?([^\"]+)\"?)?/i);\n if (match) {\n const [, ip, list = 'trusted', timeout = '30d', comment = 'Добавлено через Telegram'] = match;\n return [{\n json: {\n chatId,\n ip: ip.trim(),\n list: list.trim(),\n timeout: timeout.trim(),\n comment: (comment || 'Добавлено через Telegram').trim(),\n action: 'add_or_update'\n }\n }];\n } else {\n return [{ json: { chatId, action: 'add_ip' } }]; // если формат кривой — просим ещё раз\n }\n}\n\n// === /find или кнопка ===\nif (text.startsWith('/find ') || callbackData === 'find_mode') {\n const search = text.startsWith('/find ') ? text.slice(6).trim() : '';\n if (!search && text !== '/find') {\n return [{ json: { chatId, action: 'find_mode' } }];\n }\n return [{ json: { chatId, search, action: 'find' } }];\n}\n\nreturn [{ json: { chatId, action: 'menu' } }];"},"name":"Parse","type":"n8n-nodes-base.function","typeVersion":1,"position":[-1616,32],"id":"58d61cc2-c411-4c2e-91bd-b2827805deb8"},{"parameters":{"authentication":"genericCredentialType","genericAuthType":"httpBasicAuth","url":"http://10.33.33.1:8738/rest/ip/firewall/address-list","options":{}},"name":"Get All IPs","type":"n8n-nodes-base.httpRequest","typeVersion":2,"position":[-912,-32],"id":"6072ec58-eeb3-4596-872b-991416ebfbed","credentials":{"httpBasicAuth":{"id":"gBAUOrSceRAWqNfB","name":"mikrot api"}}},{"parameters":{"authentication":"genericCredentialType","genericAuthType":"httpBasicAuth","requestMethod":"={{ $json.action === 'delete' ? 'DELETE' : 'PATCH' }}","url":"http://10.33.33.1:8738/rest/ip/firewall/address-list/{{ $json.entryId }}","jsonParameters":true,"options":{},"bodyParametersJson":"={{ $json.action === 'delete' ? {} : { list: $json.newList } }}"},"name":"Move or Delete","type":"n8n-nodes-base.httpRequest","typeVersion":2,"position":[-912,496],"id":"c059b155-ff98-433a-82fb-2e4e883934bb","credentials":{"httpBasicAuth":{"id":"gBAUOrSceRAWqNfB","name":"mikrot api"}}},{"parameters":{"authentication":"genericCredentialType","genericAuthType":"httpBasicAuth","requestMethod":"POST","url":"http://10.33.33.1:8738/rest/ip/firewall/address-list/add","jsonParameters":true,"options":{},"bodyParametersJson":"={{\n {\n \"address\": $json.ip,\n \"list\": $json.list,\n \"timeout\": $json.timeout,\n \"comment\": $json.comment\n }\n}}"},"name":"Add or Update IP","type":"n8n-nodes-base.httpRequest","typeVersion":2,"position":[-912,288],"id":"1bf702a3-cafc-4d3e-b993-66620011481b","credentials":{"httpBasicAuth":{"id":"gBAUOrSceRAWqNfB","name":"mikrot api"}}},{"parameters":{"chatId":"={{ $json.chatId }}","text":"={{$json.text}}","replyMarkup":"inlineKeyboard","additionalFields":{}},"name":"Send Inline Results","type":"n8n-nodes-base.telegram","typeVersion":1,"position":[-416,-32],"id":"2c319907-41c4-420b-85f0-d6d3ae1b02fa","webhookId":"a698532b-1bce-4863-9bd5-5ab4ba641b64","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"chatId":"={{ $json.chatId }}","text":"*Управление MikroTiLine truncated
+1
View File
@@ -0,0 +1 @@
{"updatedAt":"2025-12-03T08:56:41.048Z","createdAt":"2025-11-29T21:38:38.667Z","id":"QkcQOlUlhxvB4Urv","name":"My workflow","active":false,"isArchived":true,"nodes":[{"parameters":{"updates":["*"],"additionalFields":{}},"name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1,"position":[-400,208],"id":"67242ab2-91ef-45ed-b065-7f3464a6d373","webhookId":"8da6a665-bf05-49f4-b17d-2a302fd2ecda","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram account"}}},{"parameters":{"functionCode":"// Парсим сообщение из Telegram\nconst message = $input.all()[0].json.message.text;\nconst chatId = $input.all()[0].json.message.chat.id;\n\n// Проверяем формат сообщения (пример: /addip 192.168.1.100 trusted_ips 1d \"Комментарий\")\nconst match = message.match(/^\\/addip (\\d+\\.\\d+\\.\\d+\\.\\d+)(?: (\\S+)(?: (\\S+)(?: \"(.+)\")?)?)?/);\n\nif (!match) {\n return [{\n json: {\n chatId,\n error: 'Неверный формат. Используйте: /addip IP [list] [timeout] \"[comment]\"'\n }\n }];\n}\n\n// Извлекаем параметры\nconst [, ipAddress, addressList = 'trusted_hosts', timeout = '1d', comment = 'Added via Telegram'] = match;\n\nreturn [{\n json: {\n chatId,\n ipAddress,\n addressList,\n timeout,\n comment,\n success: true\n }\n}];"},"name":"Parse Telegram Command","type":"n8n-nodes-base.function","typeVersion":1,"position":[-208,208],"id":"cd42faf3-6552-4055-bba0-a0f0742e02ee"},{"parameters":{"authentication":"basicAuth","requestMethod":"POST","url":"http://10.33.33.1:8738/rest/ip/firewall/address-list","jsonParameters":true,"options":{},"bodyParametersJson":"{\n \"address\": \"{{$node['Parse Telegram Command'].json['ipAddress']}}\",\n \"list\": \"{{$node['Parse Telegram Command'].json['addressList']}}\",\n \"timeout\": \"{{$node['Parse Telegram Command'].json['timeout']}}\",\n \"comment\": \"{{$node['Parse Telegram Command'].json['comment']}}\"\n}"},"name":"MikroTik API Request","type":"n8n-nodes-base.httpRequest","typeVersion":1,"position":[0,208],"id":"8f7a7535-0423-4111-a4ad-fa1d8d57334c","credentials":{"httpBasicAuth":{"id":"gBAUOrSceRAWqNfB","name":"mikrot api"}}},{"parameters":{"operation":"send"},"name":"Telegram Success","type":"n8n-nodes-base.telegram","typeVersion":1,"position":[208,112],"id":"16fb0c34-49e5-48d5-b1a4-0eeb44b40e13","webhookId":"0260be7d-496c-4728-a861-e41d14cbdd5e","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram account"}}},{"parameters":{"operation":"send"},"name":"Telegram Error","type":"n8n-nodes-base.telegram","typeVersion":1,"position":[208,304],"id":"976d6166-60de-4b06-99bb-c2e027229050","webhookId":"06a8453c-242e-48c4-b5b7-b868a23dc102","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram account"}}}],"connections":{"Telegram Trigger":{"main":[[{"node":"Parse Telegram Command","type":"main","index":0}]]},"Parse Telegram Command":{"main":[[{"node":"MikroTik API Request","type":"main","index":0}]]},"MikroTik API Request":{"main":[[{"node":"Telegram Success","type":"main","index":0},{"node":"Telegram Error","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"8955e382-3a25-4495-aa00-7f7aeef3e9eb","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-11-29T21:38:38.667Z","createdAt":"2025-11-29T21:38:38.667Z","role":"workflow:owner","workflowId":"QkcQOlUlhxvB4Urv","projectId":"sYuiFAb87pAir6jV"}],"activeVersion":null,"tags":[]}
+1
View File
@@ -0,0 +1 @@
{"updatedAt":"2025-12-05T13:12:59.842Z","createdAt":"2025-12-03T08:32:37.392Z","id":"nJ2eDjcQO5DPZuWz","name":"RAG in n8n","active":false,"isArchived":false,"nodes":[{"parameters":{"formTitle":"Upload your data to test RAG","formFields":{"values":[{"fieldLabel":"Upload your file(s)","fieldType":"file","acceptFileTypes":".pdf, .csv, .docx","requiredField":true}]},"options":{}},"type":"n8n-nodes-base.formTrigger","typeVersion":2.2,"position":[-128,0],"id":"f7a656ec-83fc-4ed2-a089-57a9def662b7","name":"Upload your file here","webhookId":"82848bc4-5ea2-4e5a-8bb6-3c09b94a8c5d"},{"parameters":{"options":{}},"type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","typeVersion":1.2,"position":[80,336],"id":"6ea78663-cf2f-4f2d-8e68-43047c2afd87","name":"Embeddings OpenAI","credentials":{"openAiApi":{"id":"PvUURuR361IXH0ve","name":"OpenAi account"}}},{"parameters":{"dataType":"binary","options":{}},"type":"@n8n/n8n-nodes-langchain.documentDefaultDataLoader","typeVersion":1.1,"position":[320,176],"id":"94aecac0-03f9-4915-932b-d14a2576607b","name":"Default Data Loader"},{"parameters":{"content":"### 📚 Load Data Flow","height":524,"width":700,"color":7},"type":"n8n-nodes-base.stickyNote","position":[-176,-64],"typeVersion":1,"id":"d19d04f3-5231-4e47-bed7-9f24a4a8f582","name":"Sticky Note1"},{"parameters":{"mode":"insert","memoryKey":{"__rl":true,"value":"vector_store_key","mode":"list","cachedResultName":"vector_store_key"}},"type":"@n8n/n8n-nodes-langchain.vectorStoreInMemory","typeVersion":1.2,"position":[64,0],"id":"bf50a11f-ca6a-4e04-a6d2-42fee272b260","name":"Insert Data to Store"},{"parameters":{"mode":"retrieve-as-tool","toolName":"knowledge_base","toolDescription":"Use this knowledge base to answer questions from the user","memoryKey":{"__rl":true,"mode":"list","value":"vector_store_key"}},"type":"@n8n/n8n-nodes-langchain.vectorStoreInMemory","typeVersion":1.2,"position":[1184,352],"id":"09c0db62-5413-440e-8c13-fb6bb66d9b6a","name":"Query Data Tool"},{"parameters":{"promptType":"define","text":"={{ $json.text }}","options":{"systemMessage":"You are a helpful personal finder called Jackie. \n\nGuidelines:\n- Always use Query Data Tool"}},"type":"@n8n/n8n-nodes-langchain.agent","typeVersion":2,"position":[1024,160],"id":"579aed76-9644-42d1-ac13-7369059ff1c2","name":"AI Agent"},{"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","typeVersion":1.2,"position":[880,272],"id":"b5aa8942-9cd5-4c2f-bd77-7a0ceb921bac","name":"OpenAI Chat Model","credentials":{"openAiApi":{"id":"PvUURuR361IXH0ve","name":"OpenAi account"}}},{"parameters":{"content":"### 🐕 2. Retriever Flow","height":524,"width":840,"color":7},"type":"n8n-nodes-base.stickyNote","position":[608,-64],"typeVersion":1,"id":"28bc73a1-e64a-47bf-ac1c-ffe644894ea5","name":"Sticky Note2"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"6d3fc987-0504-4f15-b44e-ac9e87156954","leftValue":"={{ $json.message.text }}","rightValue":"","operator":{"type":"string","operation":"empty","singleValue":true}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[928,-32],"id":"9a04ceb1-964f-4259-8793-370381079d66","name":"If"},{"parameters":{"resource":"file","fileId":"={{ $('Listen for incoming events').item.json.message.voice.file_id }}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[1088,-48],"id":"20917588-1eb9-4b32-9335-2aa6f1e06e28","name":"Get Voice File","webhookId":"b76dc106-a130-42f4-b6d4-c1b2cce03819","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"resource":"audio","operation":"transcribe","options":{}},"type":"@n8n/n8n-nodes-langchain.openAi","typeVersion":2.1,"position":[1296,-48],"id":"29407c24-bd2d-4fb1-9880-fdc185f4a410","name":"Transcribe a recording","credentials":{"openAiApi":{"id":"PvUURuR361IXH0ve","name":"OpenAi account"}}},{"parameters":{"assignments":{"assignments":[{"id":"39d69a44-fc96-44b7-8bd7-8e9129084420","name":"text","value":"={{ $json?.message?.text || \"\" }}","type":"string"}]},"includeOtherFields":true,"options":{}},"type":"n8n-nodes-base.set","typeVersion":3.4,"position":[784,-32],"id":"a706425f-2d1d-4654-944a-7f2a85bbdc59","name":"Voice or Text"},{"parameters":{"updates":["message"],"additionalFields":{}},"type":"n8n-nodes-base.telegramTrigger","typeVersion":1.2,"position":[624,-16],"id":"33453c04-30aa-4401-87b2-b306d8cb4c24","name":"Listen for incoming events","webhookId":"a236a2f1-1eff-465b-aba5-b1505f1c3a18","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"chatId":"={{ $('Listen for incoming events').first().json.message.from.id }}","text":"={{ $json.output }}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[1328,160],"id":"fda54a79-1a02-4a5c-9aef-0453bc44e47Line truncated
@@ -0,0 +1 @@
{"updatedAt":"2025-12-20T09:44:00.286Z","createdAt":"2025-12-20T08:24:59.964Z","id":"IUYOCZtINnHMUhWI","name":"Remnawave Final Loop Fix","active":true,"isArchived":false,"nodes":[{"parameters":{"updates":["message"],"additionalFields":{}},"id":"eb97aa49-b1b6-4249-8a9d-60254966b59d","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1,"position":[-528,160],"webhookId":"remnawave-add-user","credentials":{"telegramApi":{"id":"XfLtzJeW8r1QKw4d","name":"Telegram pomoshnik_monster"}}},{"parameters":{"jsCode":"// Получаем текст\nconst text = $('Telegram Trigger').first().json.message.text;\n\n// Настройки времени\nlet days = 30;\nlet durationMultiplier = 24 * 60 * 60 * 1000;\n\n// Парсим срок (30d, 1m, 24h)\nconst durationRegex = /\\b(\\d+)([dmh])\\b/i;\nconst durationMatch = text.match(durationRegex);\n\nif (durationMatch) {\n const value = parseInt(durationMatch[1]);\n const unit = durationMatch[2].toLowerCase();\n if (unit === 'd') days = value;\n if (unit === 'm') days = value * 30;\n if (unit === 'h') days = value / 24;\n}\n\n// Считаем дату окончания\nconst expireDateSec = Math.floor((Date.now() + (days * durationMultiplier)) / 1000);\n\n// Ищем юзеров\nconst lines = text.split(/[\\n\\s]+/);\nconst users = [];\n\nfor (const line of lines) {\n const cleanLine = line.trim();\n if (!cleanLine) continue;\n if (cleanLine.startsWith('/')) continue;\n if (cleanLine.match(durationRegex)) continue;\n \n users.push(cleanLine);\n}\n\nreturn users.map(user => ({\n json: {\n username: user,\n expireDateSec: expireDateSec,\n days: days\n }\n}));"},"id":"f135a0a1-f751-4e59-866f-1e617b61ae3c","name":"Parse Input","type":"n8n-nodes-base.code","typeVersion":2,"position":[-96,160]},{"parameters":{"batchSize":1,"options":{}},"id":"6e21712b-51fc-454d-a744-e05feccfeee0","name":"Split In Batches","type":"n8n-nodes-base.splitInBatches","typeVersion":2,"position":[128,160]},{"parameters":{"method":"POST","url":"={{ $('Config').item.json.BASE_URL }}/api/users","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"={{ 'Bearer ' + $('Config').item.json.API_TOKEN }}"}]},"sendBody":true,"bodyParameters":{"parameters":[{"name":"username","value":"={{ $json.username }}"},{"name":"expireAt","value":"={{ new Date($json.expireDateSec * 1000).toISOString() }}"},{"name":"externalSquadUuid","value":"={{ $('Config').item.json.EXTERNAL_SQUAD_ID ? $('Config').item.json.EXTERNAL_SQUAD_ID : null }}"},{"name":"trafficLimitBytes","value":0},{"name":"trafficLimitStrategy","value":"NO_RESET"}]},"options":{}},"id":"0bac5c3d-d051-4da9-ada2-2ce2bd883127","name":"1. Create User","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[368,48],"onError":"continueErrorOutput"},{"parameters":{"method":"POST","url":"={{ $('Config').item.json.BASE_URL }}/api/internal-squads/{{ $('Config').item.json.INTERNAL_SQUAD_ID }}/bulk-actions/add-users","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"={{ 'Bearer ' + $('Config').item.json.API_TOKEN }}"}]},"sendBody":true,"bodyParameters":{"parameters":[{"name":"uuids","value":"={{ [ $json.uuid ] }}"}]},"options":{}},"id":"d13903c8-4292-4a22-8be0-c4b1b7cda704","name":"2. Add to Squad","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[576,48],"onError":"continueErrorOutput"},{"parameters":{"chatId":"={{ $('Telegram Trigger').item.json.message.chat.id }}","text":"={{ $('Split In Batches').item.json.username }} — ✅ Создан и добавлен в группу\nего подписка:\n{{ $('1. Create User').item.json.response.subscriptionUrl }}","additionalFields":{"parse_mode":"HTML"}},"id":"0a9103c9-928d-4982-9692-734b4a841bee","name":"Reply Success","type":"n8n-nodes-base.telegram","typeVersion":1,"position":[800,48],"webhookId":"aa2109f8-e48b-4d2f-b557-509cea0428f7","credentials":{"telegramApi":{"id":"XfLtzJeW8r1QKw4d","name":"Telegram pomoshnik_monster"}}},{"parameters":{"chatId":"={{ $('Telegram Trigger').item.json.message.chat.id }}","text":"={{ $('Split In Batches').item.json.username }} — ❌ Ошибка: {{ $input.item.json.message || JSON.stringify($input.item.json) }}","additionalFields":{}},"id":"825fa336-4485-40cf-a132-60ad0adef891","name":"Reply Error","type":"n8n-nodes-base.telegram","typeVersion":1,"position":[800,256],"webhookId":"9719e5da-0945-4e1a-8c15-82e88b89e91d","credentials":{"telegramApi":{"id":"XfLtzJeW8r1QKw4d","name":"Telegram pomoshnik_monster"}}},{"parameters":{"fields":{"values":[{"name":"BASE_URL","stringValue":"https://panel.infra.pet"},{"name":"API_TOKEN","stringValue":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1dWlkIjoiNDQ4NDNmNjAtYzY3YS00OWM3LWJkOWMtMzEwOGE4ZTkxYjM2IiwidXNlcm5hbWUiOm51bGwsInJvbGUiOiJBUEkiLCJpYXQiOjE3NjYyMTkwMjUsImV4cCI6MTA0MDYxMzI2MjV9.QTcYdHeCYegiFbodTy6Q0VPExvso8ui-7kujxEjl1D0"},{"name":"INTERNAL_SQUAD_ID","stringVLine truncated
@@ -0,0 +1 @@
{"updatedAt":"2025-12-05T13:44:57.168Z","createdAt":"2025-12-05T13:12:22.196Z","id":"pbxJhgKargb04QBi","name":"TG to AI (Final Fixed)","active":false,"isArchived":false,"nodes":[{"parameters":{"updates":["message"],"additionalFields":{"download":true}},"id":"a80f3e49-fabb-4d68-96d9-aee529d8b518","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1.1,"position":[-576,400],"webhookId":"tg-webhook","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"method":"POST","url":"https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Accept","value":"application/json"}]},"sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"name":"text_prompts[0][text]","value":"={{ $json.message.caption || \"high quality, detailed\" }}"},{"name":"text_prompts[0][weight]","value":"1"},{"name":"init_image_mode","value":"IMAGE_STRENGTH"},{"name":"image_strength","value":"0.35"},{"name":"samples","value":"2"},{"name":"steps","value":"30"},{"parameterType":"formBinaryData","name":"init_image","inputDataFieldName":"data"}]},"options":{}},"id":"e3559163-6cfb-4722-af60-122dfd0137c5","name":"Stability AI Request","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-144,400],"credentials":{"httpHeaderAuth":{"id":"U4iKTPOIVsBzAyTa","name":"stable.ai"}}},{"parameters":{"jsCode":"// Получаем артефакты (картинки) из JSON ответа\n// Stability AI возвращает массив 'artifacts'\nconst artifacts = items[0].json.artifacts;\nconst results = [];\n\n// Проходимся по всем картинкам (их будет 2, так как samples=2)\nif (artifacts && artifacts.length > 0) {\n artifacts.forEach((image, index) => {\n results.push({\n json: {\n finishReason: image.finishReason,\n seed: image.seed,\n info: `Вариант ${index + 1}`\n },\n binary: {\n data: {\n data: image.base64,\n mimeType: 'image/png',\n fileExtension: 'png',\n fileName: `generated_${index}.png`\n }\n }\n });\n });\n} else {\n // Если что-то пошло не так и картинок нет\n return [];\n}\n\nreturn results;"},"id":"0ccdeca0-0975-402d-917a-c339b4aaa4f0","name":"Process Response","type":"n8n-nodes-base.code","typeVersion":2,"position":[80,400]},{"parameters":{"operation":"sendPhoto","chatId":"={{ $('Telegram Trigger').item.json.message.chat.id }}","binaryData":true,"additionalFields":{}},"id":"5963fd17-15d7-471d-8a43-a48eff236139","name":"Send Photo to TG","type":"n8n-nodes-base.telegram","typeVersion":1.1,"position":[304,400],"webhookId":"dbde12a9-bb16-4e39-8e79-447addb70b92","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"operation":"resize","width":1024,"height":1024,"resizeOption":"ignoreAspectRatio","options":{}},"type":"n8n-nodes-base.editImage","typeVersion":1,"position":[-352,400],"id":"6237fa02-50df-4df0-915b-5c39973ce931","name":"Edit Image"}],"connections":{"Stability AI Request":{"main":[[{"node":"Process Response","type":"main","index":0}]]},"Process Response":{"main":[[{"node":"Send Photo to TG","type":"main","index":0}]]},"Edit Image":{"main":[[{"node":"Stability AI Request","type":"main","index":0}]]},"Telegram Trigger":{"main":[[{"node":"Edit Image","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"333e1db5-0737-4667-adca-6f9cc9d549a0","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-12-05T13:12:22.196Z","createdAt":"2025-12-05T13:12:22.196Z","role":"workflow:owner","workflowId":"pbxJhgKargb04QBi","projectId":"sYuiFAb87pAir6jV"}],"activeVersion":null,"tags":[]}
@@ -0,0 +1 @@
{"updatedAt":"2025-10-27T08:03:18.061Z","createdAt":"2025-10-23T11:46:12.459Z","id":"d02Xv9I3If0Qt4aj","name":"Telegram → AI Workflow Creator (Fixed)","active":false,"isArchived":false,"nodes":[{"parameters":{"updates":["message"],"additionalFields":{}},"id":"c425cc32-f48b-42b3-a51c-74995b95983e","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1.2,"position":[-880,-128],"webhookId":"telegram-webhook","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram account"}}},{"parameters":{"jsCode":"const inputData = $input.first() || {};\nconsole.log('Input Data:', JSON.stringify(inputData, null, 2));\n\nconst jsonData = inputData.json || {};\nif (!jsonData || typeof jsonData !== 'object') {\n return [{\n json: {\n error: 'Некорректные данные от Telegram. Ожидался объект json.',\n chat_id: '',\n message_id: ''\n }\n }];\n}\n\nconst message = jsonData.message || {};\nif (!message || typeof message !== 'object') {\n return [{\n json: {\n error: 'Некорректные данные от Telegram. Ожидался объект message.',\n chat_id: '',\n message_id: ''\n }\n }];\n}\n\nif (!message.text) {\n return [{\n json: {\n error: 'Это не текстовое сообщение. Отправьте текстовую команду.',\n chat_id: message.chat?.id || '',\n message_id: message.message_id || ''\n }\n }];\n}\n\nconst messageText = message.text || '';\nconst chatId = message.chat?.id || '';\nconst messageId = message.message_id || '';\n\nconst regex = /^\\/create\\s+(.+)/;\nconst match = messageText.match(regex);\n\nif (match) {\n return [{\n json: {\n description: match[1].trim(),\n chat_id: chatId,\n message_id: messageId,\n success: true\n }\n }];\n} else {\n return [{\n json: {\n error: 'Команда не распознана. Используйте: /create <описание workflow>',\n chat_id: chatId,\n message_id: messageId,\n success: false\n }\n }];\n}"},"id":"a6cbef33-941f-4a06-b5b9-315c8451e1de","name":"Check /create Command","type":"n8n-nodes-base.code","typeVersion":2,"position":[-640,-128]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"1","leftValue":"={{ $json.success }}","rightValue":"true"}],"combinator":"and"},"options":{}},"id":"90a71303-43a5-47a6-9de8-036a9429e4f6","name":"If Success","type":"n8n-nodes-base.if","typeVersion":2,"position":[-400,-128]},{"parameters":{"jsCode":"const description = $json.description;\nconst chatId = $json.chat_id;\nconst messageId = $json.message_id;\n\nconsole.log('Generating workflow for:', description);\n\nconst requestBody = {\n model: \"gpt-4o-mini\",\n messages: [\n {\n role: \"system\",\n content: \"Ты эксперт по n8n. Генерируй ВАЛИДНЫЙ JSON для импорта workflow в n8n по описанию пользователя. Структура: {name: string, nodes: [], connections: {}, settings: {}, tags: []}. Каждый node должен иметь: id (uuid), name, type, typeVersion, position [x,y], parameters. Используй случайные UUID для id. Верни ТОЛЬКО валидный JSON без каких-либо объяснений или текста вокруг.\"\n },\n {\n role: \"user\", \n content: \"Создай n8n workflow JSON для: \" + description\n }\n ],\n max_tokens: 4000,\n temperature: 0.1\n};\n\ntry {\n const response = await $http({\n method: 'POST',\n url: 'https://api.openai.com/v1/chat/completions',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': 'Bearer ' + $credentials.openAiApi.apiKey\n },\n body: JSON.stringify(requestBody),\n timeout: 30000\n });\n\n console.log('OpenAI Response Status:', response.status);\n \n if (response.status !== 200) {\n throw new Error(`OpenAI API error: ${response.status} - ${JSON.stringify(response.body)}`);\n }\n\n const responseData = response.body;\n \n if (!responseData.choices || !responseData.choices[0]) {\n throw new Error('Некорректный ответ от OpenAI: нет choices');\n }\n\n const aiResponse = responseData.choices[0].message.content.trim();\n console.log('AI Raw Response:', aiResponse);\n\n let workflowJson;\n try {\n const cleanResponse = aiResponse.replace(/```json\\n?|```\\n?/g, '');\n workflowJson = JSON.parse(cleanResponse);\n } catch (error) {\n throw new Error('AI вернул невалидный JSON: ' + error.message + '. Raw: ' + aiResponse.substring(0, 200));\n }\n\n if (!workflowJson.name) {\n workflowJson.name = 'AI Generated Workflow - ' + description.substring(0, 30);\n }\n if (!workflowJson.nodes) workflowJson.nodes = [];\n if (!workflowJson.connections) workflowJson.connecLine truncated
@@ -0,0 +1 @@
{"updatedAt":"2025-10-23T11:54:34.689Z","createdAt":"2025-10-23T10:10:14.976Z","id":"yyXLAtVh1rd9lwEE","name":"Telegram → AI Workflow Creator New","active":false,"isArchived":false,"nodes":[{"parameters":{"updates":["message"],"additionalFields":{}},"id":"5bb9a6f2-57e6-4bf8-86bc-e383b063f9d8","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1.2,"position":[0,0],"webhookId":"telegram-webhook","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram account"}}},{"parameters":{"jsCode":"const inputData = $input.first() || {};\nconst message = inputData.json?.message || {};\nconst messageText = message.text || '';\nconst chatId = message.chat?.id || '';\nconst messageId = message.message_id || '';\n\nconst regex = /^\\/create\\s+(.+)/;\nconst match = messageText.match(regex);\n\nif (match) {\n return [{\n json: {\n description: match[1].trim(),\n chat_id: chatId,\n message_id: messageId\n }\n }];\n} else {\n return [{\n json: {\n error: 'Команда не распознана. Используйте /create <описание>',\n chat_id: chatId,\n message_id: messageId\n }\n }];\n}"},"id":"febf518b-beda-4202-b613-ea7f09285a81","name":"Check /create Command","type":"n8n-nodes-base.code","typeVersion":2,"position":[224,0]},{"parameters":{"jsCode":"const inputData = $input.first();\n\nreturn [{\n json: {\n description: inputData?.json?.description || '',\n chat_id: inputData?.json?.chat_id || '',\n message_id: inputData?.json?.message_id || ''\n }\n}];"},"id":"0a13c28d-bd75-4ea1-acf9-a123606d7162","name":"Extract Description","type":"n8n-nodes-base.code","typeVersion":2,"position":[448,0]},{"parameters":{"method":"POST","url":"https://api.openai.com/v1/chat/completions","authentication":"predefinedCredentialType","nodeCredentialType":"openAiApi","sendHeaders":true,"headerParameters":{"parameters":[{"name":"Content-Type","value":"application/json"}]},"sendBody":true,"bodyParameters":{"parameters":[{"name":"model","value":"gpt-4o-mini"},{"name":"messages","value":"=JSON.parse('[{\"role\": \"system\", \"content\": \"Ты эксперт по n8n. Генерируй ВАЛЬНЫЙ JSON для импорта воркфлоу n8n по описанию пользователя. Используй актуальную структуру n8n (версия 1.x). Включи: name, nodes[], connections{}. Каждый node должен иметь: id, name, type, typeVersion, position[], parameters{}. Соединяй ноды через connections. Верни ТОЛЬКО валидный JSON без объяснений.\"}, {\"role\": \"user\", \"content\": \"Создай n8n workflow JSON: {{ $json.description }}\"}]')"},{"name":"max_tokens","value":4000},{"name":"temperature","value":0.1}]},"options":{}},"id":"536068e0-b3ec-41d1-bd9f-c61902458683","name":"Generate Workflow (AI)","type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[896,0],"credentials":{"openAiApi":{"id":"PvUURuR361IXH0ve","name":"OpenAi account"}}},{"parameters":{"jsCode":"const response = $input.first().json;\nconst aiResponse = response.choices[0].message.content;\n\n// Парсим JSON из ответа AI\nlet workflowJson;\ntry {\n workflowJson = JSON.parse(aiResponse);\n} catch (error) {\n throw new Error('AI вернул невалидный JSON: ' + error.message);\n}\n\nreturn {\n ...$input.first().json,\n workflow: workflowJson,\n chat_id: $('Extract Description').first().json.chat_id,\n message_id: $('Extract Description').first().json.message_id\n};"},"id":"66f7f81f-5720-49ba-a1d5-62ebab96d1c8","name":"Parse Workflow JSON","type":"n8n-nodes-base.code","typeVersion":2,"position":[1120,0]},{"parameters":{"method":"POST","url":"=https://{{ $vars.N8N_HOST || 'your-n8n-instance.com' }}/api/v1/workflows","authentication":"predefinedCredentialType","nodeCredentialType":"n8nApi","sendBody":true,"bodyParameters":{"parameters":[{"name":"name","value":"={{ $json.workflow.name || 'New Workflow' }}"},{"name":"nodes","value":"=JSON.stringify($json.workflow.nodes)"},{"name":"connections","value":"=JSON.stringify($json.workflow.connections)"},{"name":"active","value":false}]},"options":{"response":{"response":{"fullResponse":true}}}},"id":"24511dfd-63d3-4dc3-9876-593b298bbe7f","name":"Create Workflow (API)","type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[1328,0],"credentials":{"n8nApi":{"id":"LFyobxvAMNg8Kk5i","name":"n8n account"}}},{"parameters":{"jsCode":"const apiResponse = $input.first().json;\nconst workflowData = $('Parse Workflow JSON').first().json.workflow;\nconst baseData = $('Extract Description').first().json;\n\nif (apiResponse.id) {\n return {\n success: true,\n workflow_id: apiResponse.id,\n workflow_name: workflowData.name,\n chat_id: baseData.chat_id,\n message_id: baseData.message_id,\n workflow_json: workflowData\n };\n} else {\n return {\n success: false,\n error: Line truncated
@@ -0,0 +1 @@
{"updatedAt":"2025-11-29T20:43:06.821Z","createdAt":"2025-11-29T20:43:06.821Z","id":"Xe0lkIQfcKyw4YLB","name":"Telegram-n8n-Commander","active":false,"isArchived":false,"nodes":[{"parameters":{"updates":["message"],"additionalFields":{"chatIds":"123456789","userIds":"123456789"}},"id":"e15d13ae-e02e-4294-b8a7-a75b2e61ae00","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[144,1104],"webhookId":"0eea20d1-fab3-416e-8f22-6f975f79650b","typeVersion":1.2,"credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram account"}},"disabled":true},{"parameters":{"assignments":{"assignments":[{"id":"ce8eebdd-c313-4444-a1bd-dcde56619a0d","name":"command","type":"string","value":"={{\n $json.message.text\n .toLowerCase()\n .replace(/^\\//, '')\n .split(/ (.+)/)[0]\n || ''\n}}"},{"id":"834f7369-52f1-4df3-bfcb-754be0bb11e0","name":"arg1","type":"string","value":"={{\n $json.message.text\n .toLowerCase()\n .replace(/^\\//, '')\n .split(/ (.+)/)[1]\n || ''\n}}"}]},"options":{}},"id":"88c70f41-f8a1-4c06-a99d-6830911855a4","name":"Cmd Parse","type":"n8n-nodes-base.set","position":[368,1104],"typeVersion":3.4},{"parameters":{"rules":{"values":[{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d5b702ed-dcaf-461a-a148-04b231d55617","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"start"}]},"renameOutput":true,"outputKey":"start"},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"e9ac521f-9416-4756-9f3c-9be5dd5a5ccb","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"help"}]},"renameOutput":true,"outputKey":"help"},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"e20bdf17-2418-43ad-8b37-a4a5f4e46b2a","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"backup"}]},"renameOutput":true,"outputKey":"backup"},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b1dfbc98-aac0-483c-a386-79180e96d0bb","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"cleanup"}]},"renameOutput":true,"outputKey":"cleanup"},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"2524d410-a971-4a1f-b8a1-c30d363c6be6","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"workflows"}]},"renameOutput":true,"outputKey":"workflows"},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"a27bd761-d2d6-4768-9449-ca5380db38ce","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"execute"}]},"renameOutput":true,"outputKey":"execute"},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"593d46f5-40ce-468a-b834-c2376dca1684","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"activate"}]},"renameOutput":true,"outputKey":"activate"},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"0ff85afd-02f8-42ad-b892-59b3dcf025a9","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"deactivate"}]},"renameOutput":true,"outputKey":"deactivate"},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"f5dee847-2c55-427f-a1f9-3f038f19e30e","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"executions"}]},"renameOutput":true,"outputKey":"executions"}]},"options":{"fallbackOutput":"extra","ignoreCase":true,"renameFallbackOutput":"Error"}},"id":"17f7f8cb-a76c-4f51-9ca9-9c92769db076","name":"Cmd Switch","type":"n8n-nodes-base.switch","position":[592,960],"executeOnce":false,"typeVersion":3.2},{"parameters":{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},Line truncated
@@ -0,0 +1 @@
{"updatedAt":"2025-12-12T09:44:10.802Z","createdAt":"2025-12-12T09:43:57.181Z","id":"HeNuVT2DB61vKm6y","name":"Traffic Forecast Dynamic","active":false,"isArchived":false,"nodes":[{"parameters":{"updates":["message"],"additionalFields":{}},"name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1,"position":[-592,-112],"id":"9bd9cd1c-102e-4aa8-8d6e-b69e5003931c","webhookId":"traffic-forecast-bot","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"resource":"file","fileId":"={{ $json.message.document.file_id }}","additionalFields":{}},"name":"Get File","type":"n8n-nodes-base.telegram","typeVersion":1,"position":[-368,-112],"id":"f4e44340-4096-4c3d-b043-855f418977e0","webhookId":"b572f623-3010-47da-b480-eae5ae111b38","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"options":{}},"name":"Parse File","type":"n8n-nodes-base.spreadsheetFile","typeVersion":2,"position":[-144,-112],"id":"80ae83b6-aa9a-48fb-b2ac-18826df7f7ad"},{"parameters":{"jsCode":"// --- НАСТРОЙКИ МОДЕЛИ ---\n// Alpha (0.1 - 0.9). Чем больше, тем быстрее прогноз реагирует на последние изменения.\n// 0.1 - очень плавный прогноз (учитывает долгую историю)\n// 0.8 - нервный прогноз (повторяет вчерашний день)\nconst ALPHA = 0.3; \n\n// --- ПОЛУЧЕНИЕ ДАННЫХ ---\nconst items = $input.all();\nif (items.length === 0) return [];\nconst inputData = items.map(item => item.json);\n\n// --- ВСПОМОГАТЕЛЬНЫЕ ФУНКЦИИ ---\nfunction parseCleanNumber(value) {\n if (typeof value === 'number') return value;\n if (!value) return 0;\n const cleanStr = String(value).replace(/\\s/g, '').replace(/,/g, '.');\n const parsed = parseFloat(cleanStr);\n return isNaN(parsed) ? 0 : parsed;\n}\n\nfunction getJsDateFromExcel(serial) {\n const utc_days = Math.floor(serial - 25569);\n const utc_value = utc_days * 86400; \n const date_info = new Date(utc_value * 1000);\n return new Date(date_info.getFullYear(), date_info.getMonth(), date_info.getDate());\n}\n\nfunction formatDate(date) {\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n return `${year}-${month}-${day}`;\n}\n\n// --- ШАГ 0: ПАРСИНГ И ПОДГОТОВКА ---\nconst keys = Object.keys(inputData[0]);\nconst dateKey = keys.find(k => /date|дата|день/i.test(k)) || keys[0];\nconst trafficKey = keys.find(k => /traffic|трафик|кол-во|value|факт/i.test(k)) || keys[1];\n\n// Преобразуем в удобный массив объектов\nlet parsedRows = inputData.map(row => {\n const rawTraffic = row[trafficKey];\n const rawDate = row[dateKey];\n const traffic = parseCleanNumber(rawTraffic);\n \n let date;\n if (typeof rawDate === 'number') date = getJsDateFromExcel(rawDate);\n else date = new Date(rawDate);\n\n return {\n dateObj: date,\n originalDate: rawDate,\n traffic: traffic,\n hasTraffic: traffic > 0 && !isNaN(traffic),\n isValidDate: !isNaN(date.getTime())\n };\n}).filter(r => r.isValidDate);\n\n// ВАЖНО: Сортируем по дате от прошлого к будущему\nparsedRows.sort((a, b) => a.dateObj - b.dateObj);\n\n// --- ШАГ 1: РАСЧЕТ СЕЗОННОСТИ (Глобальные паттерны) ---\n// Считаем коэффициенты дней недели и месяцев по всей доступной истории\nconst statsDay = {};\nconst statsMonth = {};\nlet globalSum = 0;\nlet globalCount = 0;\n\nparsedRows.forEach(row => {\n if (!row.hasTraffic) return;\n \n const d = row.dateObj.getDay();\n const m = row.dateObj.getMonth();\n \n globalSum += row.traffic;\n globalCount++;\n\n statsDay[d] = (statsDay[d] || {s:0, c:0});\n statsDay[d].s += row.traffic;\n statsDay[d].c++;\n\n statsMonth[m] = (statsMonth[m] || {s:0, c:0});\n statsMonth[m].s += row.traffic;\n statsMonth[m].c++;\n});\n\nconst globalAvg = globalCount > 0 ? globalSum / globalCount : 0;\n\n// Вычисляем коэффициенты (K)\nconst K_Day = {};\nconst K_Month = {};\n\nfor(let i=0; i<7; i++) {\n K_Day[i] = statsDay[i] ? (statsDay[i].s / statsDay[i].c) / globalAvg : 1.0;\n}\nfor(let i=0; i<12; i++) {\n K_Month[i] = statsMonth[i] ? (statsMonth[i].s / statsMonth[i].c) / globalAvg : 1.0;\n}\n\n// --- ШАГ 2: АДАПТИВНЫЙ ПРОГНОЗ (ЭКСПОНЕНЦИАЛЬНОЕ СГЛАЖИВАНИЕ) ---\n// Идем по времени и обновляем \"Уровень\" трафика (Level)\n\n// Начальный уровень берем как глобальноLine truncated
@@ -0,0 +1 @@
{"updatedAt":"2025-12-11T08:19:23.847Z","createdAt":"2025-12-11T07:26:21.150Z","id":"VCPJdSaOUiAvXjBI","name":"Traffic Forecast via Telegram","active":false,"isArchived":false,"nodes":[{"parameters":{"updates":["message"],"additionalFields":{}},"name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1,"position":[-592,-96],"id":"8971e1d6-fca4-4f4e-8e1d-c7e38823f716","webhookId":"traffic-forecast-bot","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"resource":"file","fileId":"={{ $json.message.document.file_id }}","additionalFields":{}},"name":"Get File","type":"n8n-nodes-base.telegram","typeVersion":1,"position":[-368,-96],"id":"54455673-f9ca-4f5a-982e-b4f94d97aed7","webhookId":"b572f623-3010-47da-b480-eae5ae111b38","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"options":{}},"name":"Parse File","type":"n8n-nodes-base.spreadsheetFile","typeVersion":2,"position":[-160,-96],"id":"a7cf8415-5a2e-44d7-8211-ae63de825efd"},{"parameters":{"jsCode":"// --- ПОЛУЧЕНИЕ ДАННЫХ ---\nconst items = $input.all();\nconst inputData = items.map(item => item.json);\n\n// --- ВСПОМОГАТЕЛЬНЫЕ ФУНКЦИИ ---\nfunction parseCleanNumber(value) {\n if (typeof value === 'number') return value;\n if (!value) return 0;\n const cleanStr = String(value).replace(/\\s/g, '').replace(/,/g, '.');\n const parsed = parseFloat(cleanStr);\n return isNaN(parsed) ? 0 : parsed;\n}\n\nfunction getJsDateFromExcel(serial) {\n const utc_days = Math.floor(serial - 25569);\n const utc_value = utc_days * 86400; \n const date_info = new Date(utc_value * 1000);\n return new Date(date_info.getFullYear(), date_info.getMonth(), date_info.getDate());\n}\n\nfunction formatDate(date) {\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n return `${year}-${month}-${day}`;\n}\n\n// --- ШАГ 1: АНАЛИЗ СТАТИСТИКИ ---\n\nlet totalTrafficSum = 0;\nlet totalCount = 0;\n\nconst trafficByDay = {}; // Дни недели (0-6)\nconst trafficByMonth = {}; // Месяцы (0-11)\nconst trafficByYear = {}; // Годы (2022, 2023...) -> ЭТО НОВОЕ\n\nif (inputData.length === 0) return [];\nconst keys = Object.keys(inputData[0]);\nconst dateKey = keys.find(k => /date|дата|день/i.test(k)) || keys[0];\nconst trafficKey = keys.find(k => /traffic|трафик|кол-во|value/i.test(k)) || keys[1];\n\n// 1. Сбор данных\nfor (const row of inputData) {\n const rawTraffic = row[trafficKey];\n const rawDate = row[dateKey];\n const traffic = parseCleanNumber(rawTraffic);\n \n // Игнорируем нули, чтобы не портить среднее\n if (traffic === 0) continue;\n\n let date;\n if (typeof rawDate === 'number') date = getJsDateFromExcel(rawDate);\n else date = new Date(rawDate);\n \n if (isNaN(date.getTime())) continue;\n\n totalTrafficSum += traffic;\n totalCount++;\n\n const d = date.getDay();\n const m = date.getMonth();\n const y = date.getFullYear(); // Получаем год\n\n // Суммы по дням недели\n trafficByDay[d] = (trafficByDay[d] || {s:0, c:0});\n trafficByDay[d].s += traffic;\n trafficByDay[d].c++;\n\n // Суммы по месяцам\n trafficByMonth[m] = (trafficByMonth[m] || {s:0, c:0});\n trafficByMonth[m].s += traffic;\n trafficByMonth[m].c++;\n\n // Суммы по годам (Тренд)\n trafficByYear[y] = (trafficByYear[y] || {s:0, c:0});\n trafficByYear[y].s += traffic;\n trafficByYear[y].c++;\n}\n\nconst avgTotalTraffic = totalCount > 0 ? totalTrafficSum / totalCount : 0;\n\n// 2. Расчет коэффициентов\nconst coeffWeekday = {};\nconst coeffMonth = {};\nconst coeffYear = {}; // Коэффициент силы года\n\n// Дни недели\nfor (let i = 0; i < 7; i++) {\n const data = trafficByDay[i];\n coeffWeekday[i] = data ? (data.s / data.c) / avgTotalTraffic : 1.0;\n}\n// Месяцы\nfor (let i = 0; i < 12; i++) {\n const data = trafficByMonth[i];\n coeffMonth[i] = data ? (data.s / data.c) / avgTotalTraffic : 1.0;\n}\n// Годы (Новое!)\nfor (const y in trafficByYear) {\n const data = trafficByYear[y];\n // Если среднее за 2024 год = 300, а общее среднее = 200, то K_Year = 1.5\n coeffYear[y] = data ? (data.s / data.c) / avgTotalTraffic : 1.0;\n}\n\n// --- ШАГ 2: РАСЧЕТ ПРОГНОЗА ---\n\nconst finalOutput = inputData.map(row => {\n const rawDate = row[dateKey];\n const rawTraffic = row[trafficKey];\n \n let date;\n let formattedDate = rawDate;\n\n if (typeof rawDate === 'number') {\n date = getJsDateFromExcel(rawDate);\n formattLine truncated
@@ -0,0 +1 @@
{"updatedAt":"2025-12-11T07:09:10.104Z","createdAt":"2025-12-11T07:09:10.104Z","id":"gxObHp6a909HAR7n","name":"Webflow_Lead_Slack_Airtable","active":false,"isArchived":false,"nodes":[{"parameters":{"path":"c646a064-5ba1-425d-8b8a-9817a9c2ebce","options":{}},"name":"Webhook","type":"n8n-nodes-base.webhook","position":[0,0],"typeVersion":2,"id":"3d5e69fa-3b24-4473-b0c6-3ff97f184b98","webhookId":"c646a064-5ba1-425d-8b8a-9817a9c2ebce"},{"parameters":{"url":"https://company.clearbit.com/v2/companies/find","options":{}},"name":"Clearbit Enrichment","type":"n8n-nodes-base.httpRequest","position":[208,0],"typeVersion":2,"id":"25f17850-b893-4a40-be0f-f61dc218f3da"},{"parameters":{},"name":"Airtable","type":"n8n-nodes-base.airtable","position":[400,0],"typeVersion":4,"id":"f03e3c72-21d0-4508-bf45-76049e97ed35","credentials":{}},{"parameters":{},"name":"Slack Alerts","type":"n8n-nodes-base.slack","position":[608,0],"typeVersion":4,"id":"33be5d0e-17b4-4462-b76d-85d22db89fef","credentials":{}}],"connections":{"Webhook":{"main":[[{"node":"Clearbit Enrichment","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"34b1e410-55a1-4039-8b4b-1abf120312db","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-12-11T07:09:10.104Z","createdAt":"2025-12-11T07:09:10.104Z","role":"workflow:owner","workflowId":"gxObHp6a909HAR7n","projectId":"sYuiFAb87pAir6jV"}],"activeVersion":null,"tags":[]}
@@ -0,0 +1 @@
{"updatedAt":"2025-12-01T10:09:37.037Z","createdAt":"2025-12-01T05:41:17.010Z","id":"odr6t7aUXIvLK7WT","name":"[DIET BOT] админ-панель","active":false,"isArchived":false,"nodes":[{"parameters":{"updates":["message"],"additionalFields":{}},"id":"52e32e3a-8fe2-4562-ade4-39e2eac546b5","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1.1,"position":[-1040,-880],"webhookId":"telegram-webhook","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":1},"conditions":[{"leftValue":"={{ $json.message.text }}","rightValue":"/admin замени_на_свой_токен","operator":{"type":"string","operation":"regex"},"id":"24222da3-3ac8-44ea-bfc9-a99eeaf72230"}],"combinator":"and"},"options":{}},"id":"42104fb7-1a41-4d48-89d5-e0522b6c58b0","name":"Ты админ?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-816,-880]},{"parameters":{"chatId":"={{ $json.message.chat.id }}","text":"❌ Доступ запрещён. Неверная команда.","additionalFields":{}},"id":"db5f2dae-0cb5-4d7d-bdf9-6579eac3ed6b","name":"Нет доступа","type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[-608,-960],"webhookId":"9c6c0d0e-d6e9-4a24-ac14-7ad31d533daf","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"chatId":"={{ $json.message.chat.id }}","text":"*🍎 Админ-панель: Правильное питание и диета*\n\nВыберите действие:","additionalFields":{}},"id":"6fe629bf-c269-45a9-ac64-09bb888fd7d8","name":"Главное меню","type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[-608,-800],"webhookId":"add2c247-811b-4a5e-878a-b975f301b779","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"updates":["callback_query"],"additionalFields":{}},"id":"f7617f76-51d7-4038-94a5-5adb10beb2a9","name":"Callback Trigger","type":"n8n-nodes-base.telegramTrigger","typeVersion":1.1,"position":[-1024,-48],"webhookId":"telegram-callback-webhook","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true},"conditions":[{"leftValue":"={{ $json.callback_query.data }}","rightValue":"^admin_|^promo|^stats|^broadcast","operator":{"type":"string","operation":"regex"}}]},"options":{}},"id":"1dd136c2-97c6-4037-9ec9-ea7ddf1fb3a9","name":"Админ callback?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-736,-48]},{"parameters":{"chatId":"={{ $json.callback_query.message.chat.id }}","text":"❌ Сессия истекла. Войдите заново: /admin токен","additionalFields":{}},"id":"c52b7b1b-ab9d-4948-a270-235680b4d67d","name":"Callback нет доступа","type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[-608,-528],"webhookId":"f9540840-0302-4efd-9035-21f41b238958","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{},"id":"4d1c876c-4426-4661-b7fa-054104f4e1f3","name":"Получить статистику","type":"n8n-nodes-base.postgres","typeVersion":1.2,"position":[-800,176]},{"parameters":{"jsCode":"// Форматируем статистику\nconst [total, active, revenue] = $input.all();\nconst totalUsers = total[0].json[0].total;\nconst activeUsers = active[0].json[0].active;\nconst totalRevenue = revenue[0].json[0].revenue;\n\nconst text = `*📊 Статистика на ${new Date().toLocaleDateString('ru-RU')}*\n\n👥 Всего пользователей: *${totalUsers}*\n💎 Активных: *${activeUsers}*\n💰 Доход: *${totalRevenue} ₽*`;\n\nreturn [{\n json: {\n text,\n chatId: $json.callback_query.message.chat.id,\n messageId: $json.callback_query.message.message_id\n }\n}];"},"id":"7b84c3ea-e5ef-4b90-82a8-856816fafe15","name":"Формат статистики","type":"n8n-nodes-base.code","typeVersion":2,"position":[-192,-304]},{"parameters":{"chatId":"={{ $json.chatId }}","text":"={{ $json.text }}","additionalFields":{}},"id":"efe72899-27c3-480a-8890-366358b9810a","name":"Отправить статистику","type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[288,-304],"webhookId":"d68178d7-3881-49f0-bdce-e0dfc3500862","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{},"id":"c62bd7be-779a-4633-aa38-5c2a6aeb8d04","name":"Получить пользователей","type":"n8n-nodes-base.postgres","typeVersion":1.2,"position":[-816,-640]},{"parameters":{"jsCode":"// Форматируем список пользователей\nconst users = $input.all()[0].json;\nconst page = $json.callback_query.data.split('_')[2];\n\nlet text = `*👥 Список пользователей (страница ${page})*\n\n`;\n\nfLine truncated
+1
View File
@@ -0,0 +1 @@
{"updatedAt":"2025-12-03T08:30:08.133Z","createdAt":"2025-11-29T20:12:24.570Z","id":"59fKEtwJ3Bj0wfyl","name":"assist","active":false,"isArchived":false,"nodes":[{"parameters":{"operation":"getAll","calendar":{"__rl":true,"value":"=lamerrrrok@gmail.com","mode":"id"},"limit":500,"options":{"timeMin":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('After', ``, 'string') }}","timeMax":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', ``, 'string') }}","fields":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Fields', ``, 'string') }}"}},"id":"75ab6a9b-2421-4279-9ed7-218981319e77","name":"Google Calendar","type":"n8n-nodes-base.googleCalendarTool","position":[3904,96],"typeVersion":1.1,"credentials":{"googleCalendarOAuth2Api":{"id":"pelU7b447VS9d9Cc","name":"Google Calendar account"}}},{"parameters":{"sessionIdType":"customKey","sessionKey":"={{ $('Listen for incoming events').first().json.message.from.id }}"},"id":"87068f41-26d6-479a-b049-87d6b04419bf","name":"Window Buffer Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[2688,96],"typeVersion":1.2},{"parameters":{"operation":"getAll","limit":20,"filters":{"labelIds":["INBOX"],"readStatus":"unread","receivedAfter":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Received_After', ``, 'string') }}","receivedBefore":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Received_Before', ``, 'string') }}"}},"id":"6a7124df-4122-461d-bfc0-4f2439073122","name":"Get Email","type":"n8n-nodes-base.gmailTool","position":[3472,96],"webhookId":"a4ae7b5d-7686-4bee-a753-848932860b4e","typeVersion":2.1,"credentials":{"gmailOAuth2":{"id":"mMAw1rTaQW76ponL","name":"Gmail account"}}},{"parameters":{"updates":["message"],"additionalFields":{}},"id":"3d0d55ec-3518-414b-8f25-f94befadae75","name":"Listen for incoming events","type":"n8n-nodes-base.telegramTrigger","position":[1552,-272],"webhookId":"322dce18-f93e-4f86-b9b1-3305519b7834","typeVersion":1,"credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"chatId":"={{ $('Listen for incoming events').first().json.message.from.id }}","text":"={{ $json.output }}","additionalFields":{"appendAttribution":false,"parse_mode":"Markdown"}},"id":"88a69a7b-b5be-4a1a-8a07-5103777ef4a8","name":"Telegram","type":"n8n-nodes-base.telegram","position":[3360,-288],"webhookId":"2c133a40-af48-4106-bc1a-be6047840a89","typeVersion":1.1,"credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}},"onError":"continueErrorOutput"},{"parameters":{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"a0bf9719-4272-46f6-ab3b-eda6f7b44fd8","operator":{"type":"string","operation":"empty","singleValue":true},"leftValue":"={{ $json.message.text }}","rightValue":""}]},"options":{}},"id":"6e79dc16-0010-4195-887b-eae299e2471b","name":"If","type":"n8n-nodes-base.if","position":[2000,-272],"typeVersion":2.2},{"parameters":{"fields":{"values":[{"name":"text","stringValue":"={{ $json?.message?.text || \"\" }}"}]},"options":{}},"id":"619eb872-6718-468a-9468-0df700a4a71f","name":"Voice or Text","type":"n8n-nodes-base.set","position":[1776,-272],"typeVersion":3.2},{"parameters":{"resource":"file","fileId":"={{ $('Listen for incoming events').item.json.message.voice.file_id }}","additionalFields":{}},"id":"bae594e9-028e-4732-907b-c79b1d5c2174","name":"Get Voice File","type":"n8n-nodes-base.telegram","position":[2224,-352],"webhookId":"ef3f120e-c212-45ff-99b5-b6a5a82598d8","typeVersion":1.1,"credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"content":"## Process Telegram Request\n","height":279,"width":624,"color":7},"id":"d6d9c72e-9de8-48b3-88a9-ceda2783d192","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[1744,-384],"typeVersion":1},{"parameters":{"content":"\n\n\n\n\n\n\n\n\n\n\n\n1. [In OpenRouter](https://openrouter.ai/settings/keys) click **“Create API key”** and copy it.\n\n2. Open the ```OpenRouter``` node:\n * **Select Credential → Create New**\n * Paste into **API Key** and **Save**\n","height":316,"width":294,"color":3},"id":"c8169b5d-eaef-4bb1-94fd-ea6b09dc210a","cid":"Ikx1Y2FzIFBleXJpbiI","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","creator":"Lucas Peyrin","position":[2256,48],"typeVersion":1,"notes":"© 2025 Lucas Peyrin"},{"parameters":{"options":{}},"id":"6fae16b5-a94d-4708-a4f2-9efd72b548d4","name":"OpenRouter","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[2352,80],"typeVersion":1,"credentials":{"openRouterApi":{"id":"zF58stjgF5xdkTLm","name":"OpenRouter account"}}},{"parameters":{"content":"\n\n\n\n\n\n\n\n\n\n\n\n\n\nThis node helps your agent remember the last few messages to stay on topic.","height":260,"width":308,"color":7},"id":"93f8d1c1-8a0f-4973-b449-523e8ff038eb","cid":"Ikx1Y2FzIFBleXJpbiI","name":"Sticky Note15","type":"n8n-nodes-base.stickyNotLine truncated
+1
View File
@@ -0,0 +1 @@
{"updatedAt":"2025-11-30T15:55:43.530Z","createdAt":"2025-11-30T14:22:32.513Z","id":"1M7DW5S6VWz9VpBh","name":"digest","active":false,"isArchived":false,"nodes":[{"parameters":{"rule":{"interval":[{"triggerAtHour":21}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[64,112],"id":"898b2c59-c464-41e9-8acb-caf02ce2a5c4","name":"Schedule Trigger"},{"parameters":{"jsCode":"// определяем начало и конец текущего дня (МСК)\nconst now = new Date(new Date().toLocaleString('en-US', { timeZone: 'Europe/Moscow' }));\nconst pad = n => String(n).padStart(2, '0');\nconst date = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;\n\nreturn [{\n json: {\n date, // '2025-05-16'\n dayStart: `${date}T00:00:00`,\n dayEnd: `${date}T23:59:59`\n }\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[240,112],"id":"1299704b-b649-4672-a00b-9d05d7e47964","name":"calcRange"},{"parameters":{"jsCode":"// items = массив строк из таблицы meals\nconst users = {}; // chat_id → агрегаты\n\nfor (const { json: r } of items) {\n const id = r.chat_id;\n const dt = new Date(r.eaten_at);\n\n if (!users[id]) {\n users[id] = {\n chat_id: id, // ← для Telegram\n gpt: { // ← для LLM\n date: $items('calcRange')[0].json.date,\n kcal: 0, prot: 0, fat: 0, carb: 0,\n meals: [] // строки «HH:MM — блюдо 200 г»\n }\n };\n }\n\n const u = users[id].gpt;\n\n // суммарные КБЖУ\n u.kcal += r.kcal;\n u.prot += r.prot;\n u.fat += r.fat;\n u.carb += r.carb;\n\n // строка тайм-лайна\n const hhmm = dt.toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit' });\n u.meals.push(`${hhmm} — ${r.dish} ${r.grams} г`);\n}\n\n// превращаем в массив items\nreturn Object.values(users).map(j => ({ json: j }));\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[624,112],"id":"8b675099-d670-400a-8f3e-55950d7f4527","name":"groupByUser"},{"parameters":{"modelId":{"__rl":true,"value":"chatgpt-4o-latest","mode":"list","cachedResultName":"CHATGPT-4O-LATEST"},"messages":{"values":[{"content":"=Ты нутри-диетолог-бот. На вход приходит отчет о питании пользователя в JSON:\n{\n \"date\": \"YYYY-MM-DD\",\n \"kcal\": число | null,\n \"prot\": число | null,\n \"fat\" : число | null,\n \"carb\": число | null,\n \"meals\": [ \"08:00 — …\", … ] // массив может быть пуст\n}\n\n✅ Если данные по КБЖУ есть - сделай отчёт:\n\n• Итог КБЖУ за день: kcal, Б, Ж, У \n• Замечания: (кратко, только если есть замечания по рациону пользователя) \n• Совет на завтра: (1 конкретная рекомендация по улучшению самочувствия или питания)\n\nВ конце: \"Если будут вопросы — пиши :)\"\n\n--------------------------------\nФормат:\n\n• Telegram-Markdown Legacy \n• Сделай текст визуально приятным, важное выдели\n• жирный — одна `*`, курсив — одна `_` \n• до 3 тематических эмоджи во всём сообщении \n• Не выдавай ``` и не возвращай JSON.\n","role":"system"},{"content":"={{ JSON.stringify($json.gpt, null, 2) }}"}]},"options":{}},"type":"@n8n/n8n-nodes-langchain.openAi","typeVersion":1.8,"position":[800,112],"id":"9273841b-ded5-453c-835a-65914ce7b014","name":"digestGPT","credentials":{"openAiApi":{"id":"PvUURuR361IXH0ve","name":"OpenAi account"}}},{"parameters":{"operation":"getAll","tableId":"meals","returnAll":true,"matchType":"allFilters","filters":{"conditions":[{"keyName":"deleted","condition":"is","keyValue":"false"},{"keyName":"eaten_at","condition":"lte","keyValue":"={{ $json.dayEnd }}"},{"keyName":"eaten_at","condition":"gte","keyValue":"={{ $json.dayStart }}"}]}},"type":"n8n-nodes-base.supabase","typeVersion":1,"position":[432,112],"id":"001813d5-c8fe-416a-aee5-4ad1532098be","name":"GET today","alwaysOutputData":false,"credentials":{"supabaseApi":{"id":"OoOx3pPUNd1lRJTr","name":"Supabase account"}}},{"parameters":{"content":"# РАССЫЛКА каждый день в 21:00 по мск\n\n\n\n","height":352,"width":1718,"color":6},"id":"f535baca-c956-4724-9d19-43bf603c2a24","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[0,0],"typeVersion":1},{"parameters":{"method":"POST","url":"https://rosfwogfdgfdgfdgfdhcc.supabase.co/rest/v1/rpc/upsert_digest","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","sendHeaders":true,"headerParLine truncated
+1
View File
@@ -0,0 +1 @@
{"updatedAt":"2025-11-29T20:49:05.134Z","createdAt":"2025-11-29T20:48:09.567Z","id":"UCNbmE7E4cwkqPUz","name":"docker manage","active":false,"isArchived":false,"nodes":[{"parameters":{"httpMethod":"POST","path":"c851e840-457c-4050-8803-4e6d258580e1","options":{}},"id":"a9418004-77a7-4fc3-a6da-e64f0c85e4de","name":"Webhook","type":"n8n-nodes-base.webhook","position":[64,160],"typeVersion":2.1,"webhookId":"77095d61-8836-4ad8-995d-f66746369cbf"},{"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4.1-mini","cachedResultName":"GPT-4.1-MINI"},"responses":{"values":[{"role":"system","content":"You are a senior IT specialist experienced in debugging distributed systems, containers, Linux services, and application logs. When the user provides log output or an error message, you must:\n\nAnalyze the logs carefully and respond in a structured format:\n\nSummary\nShort, concise explanation of what's happening.\n\nMost Likely Root Cause\nOne clear sentence. If unknown, say so and state what’s missing.\n\nImpact\nExplain if functionality is broken, partially limited, or unaffected.\n\nKey Evidence From Logs\nList only the relevant log lines and briefly explain each.\n\nSeverity Level\nRate 1–5 (1 negligible, 5 critical). Include a one-line justification.\n\nRecommended Next Steps\nBullet actionable steps. Include different paths if needed (example: “If you use USB devices…”).\n\nFollow-up / What to Monitor\nOne or two items the user should watch for or collect next.\n\nGuidelines:\n\nBe concise and structured. No long essays.\n\nNever just quote logs back. Interpret them.\n\nIf assumptions are required, state them explicitly.\n\nIf the logs do not contain enough info, say so and request specifics.\n\nTone should be calm, confident, and clear like a senior engineer helping a teammate.\n\nAvoid unnecessary technical jargon unless required.\n\nFocus on actionable clarity."},{"content":"={{ $('get logs').item.json.stdout }}"}]},"builtInTools":{},"options":{}},"id":"805eb9a4-abc4-4c68-b525-28847c91094a","name":"Message a model","type":"@n8n/n8n-nodes-langchain.openAi","position":[1712,640],"typeVersion":2,"credentials":{"openAiApi":{"id":"PvUURuR361IXH0ve","name":"OpenAi account"}}},{"parameters":{"updates":["message"],"additionalFields":{}},"id":"24fb74b7-9c06-4f37-9c25-a9befebb1ed1","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[96,672],"typeVersion":1.2,"webhookId":"06e6be4d-8b16-4c5f-9a9b-967e74cc66ff","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram account"}}},{"parameters":{"rules":{"values":[{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"a4f85833-5791-4513-bef5-f31c582bf26a","operator":{"type":"string","operation":"contains"},"leftValue":"={{ $json.message.text.toLowerCase() }}","rightValue":"logs"}]}},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"52a99c27-c2bb-49b5-9ca9-27c3de1aa9ac","operator":{"type":"string","operation":"contains"},"leftValue":"={{ $json.message.text.toLowerCase() }}","rightValue":"restart"}]}},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"f12f78c4-e959-4e50-9b1d-2a605169387d","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.message.text.toLowerCase() }}","rightValue":"status"}]}},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"3e13d044-3bfe-4669-a107-ace1b573240e","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.message.text.toLowerCase() }}","rightValue":"update"}]}}]},"options":{}},"id":"197134d7-14db-46e8-976b-fd3ea6e6ee5e","name":"Switch","type":"n8n-nodes-base.switch","position":[416,1088],"typeVersion":3.3},{"parameters":{"mode":"combine","combineBy":"combineByPosition","options":{}},"id":"b8cd9d32-f9fe-42e8-b845-37f1f658f9ad","name":"Merge","type":"n8n-nodes-base.merge","position":[1040,640],"typeVersion":3.2},{"parameters":{"mode":"combine","combineBy":"combineByPosition","options":{}},"id":"acba80b9-bf47-4228-a91c-cd0a2783f297","name":"Merge1","type":"n8n-nodes-base.merge","position":[1040,1008],"typeVersion":3.2},{"parameters":{"rules":{"values":[{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"5f956f73-4789-4fae-bedc-7c1f0edfc2d2","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.body.heartbeat.msg }}","rightValue":"running"}]}},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d1ec668d-53e8-44b2-9cb6-6a4de3bcec07","operator":{Line truncated
+1
View File
@@ -0,0 +1 @@
{"updatedAt":"2025-11-29T21:59:25.882Z","createdAt":"2025-11-29T20:59:52.613Z","id":"ToDRzIsMSKmFdU22","name":"mikrotik","active":false,"isArchived":false,"nodes":[{"parameters":{"functionCode":"const message = $input.all()[0].json.message.text;\nconst chatId = $input.all()[0].json.message.chat.id;\n\nconst match = message.match(/^\\/addip (\\d+\\.\\d+\\.\\d+\\.\\d+)(?: (\\S+)(?: (\\S+)(?: \"(.+)\")?)?)?/);\n\nif (!match) {\n return [{ json: { chatId, error: 'Формат: /addip IP [список] [таймаут] \"[комментарий]\"' } }];\n}\n\nconst [, ip, list = 'trusted', timeout = '1d', comment = 'Добавлено через Telegram'] = match;\nreturn [{ json: { chatId, ip, list, timeout, comment } }];"},"name":"Parse Command","type":"n8n-nodes-base.function","typeVersion":1,"position":[-960,976],"id":"4a48ea56-0bd0-467f-acb4-24aa6228dcd7"},{"parameters":{"authentication":"basicAuth","requestMethod":"POST","url":"http://10.33.33.1:8738/rest/ip/firewall/address-list/add","jsonParameters":true,"options":{},"bodyParametersJson":"={\n \"address\": \"{{ $json.ip }}\",\n \"list\": \"{{ $json.list }}\",\n \"timeout\": \"{{ $json.timeout }}\",\n \"comment\": \"{{ $json.comment }}\"\n}"},"name":"Add to MikroTik","type":"n8n-nodes-base.httpRequest","typeVersion":1,"position":[-720,976],"id":"03cd0c69-269b-46e3-84a9-af04ad098f6a","credentials":{"httpBasicAuth":{"id":"gBAUOrSceRAWqNfB","name":"mikrot api"}}},{"parameters":{"updates":["*"],"additionalFields":{}},"name":"Telegram Trigger1","type":"n8n-nodes-base.telegramTrigger","typeVersion":1,"position":[-1152,976],"id":"416be817-5533-4dc2-8c2e-87f266bdd2a5","webhookId":"d90faed7-0985-4037-95d5-1d5faa092ae2","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram account"}}},{"parameters":{"chatId":"1171589143","text":"ip dobalen","additionalFields":{}},"name":"Telegram Success1","type":"n8n-nodes-base.telegram","typeVersion":1,"position":[-480,976],"id":"7374248f-553c-49b3-8b34-4412faa04c70","webhookId":"321b1665-3f87-409b-a855-2e92fb4155a4","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram account"}}}],"connections":{"Parse Command":{"main":[[{"node":"Add to MikroTik","type":"main","index":0}]]},"Add to MikroTik":{"main":[[{"node":"Telegram Success1","type":"main","index":0}]]},"Telegram Trigger1":{"main":[[{"node":"Parse Command","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"a540ad77-73fa-4395-9ec4-fca15113edcf","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-11-29T20:59:52.613Z","createdAt":"2025-11-29T20:59:52.613Z","role":"workflow:owner","workflowId":"ToDRzIsMSKmFdU22","projectId":"sYuiFAb87pAir6jV"}],"activeVersion":null,"tags":[]}
+1
View File
@@ -0,0 +1 @@
{"updatedAt":"2025-12-27T21:49:21.541Z","createdAt":"2025-12-27T18:31:30.486Z","id":"BlRmzgPv0m7n7rCfoFaQE","name":"n8n_backup_gitea","active":false,"isArchived":false,"nodes":[{"parameters":{"chatId":"1171589143","text":"n8n успешно запушен","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[1040,-64],"id":"1a613417-3efd-4417-a7a0-5ac05f5fe068","name":"Send a text message","webhookId":"cd1430e6-5895-4ecd-b0df-41bb5c311f75","credentials":{"telegramApi":{"id":"L9KHcMiteyKROF5r","name":"Telegram main n8n"}}},{"parameters":{"rule":{"interval":[{"field":"cronExpression","expression":"0 0 * * *"}]}},"id":"c8765d52-406e-4de1-8353-7ec6cd6fb54c","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.1,"position":[-528,-64]},{"parameters":{"url":"http://10.33.33.70:30109/api/v1/workflows","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","options":{}},"id":"fc778077-ceb1-40ea-9ecf-2cff1bd31771","name":"Get All Workflows","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-304,-64],"credentials":{"httpHeaderAuth":{"id":"bXtIMzDotX8HKyWy","name":"n8n-api"}}},{"parameters":{"fieldToSplitOut":"data","options":{}},"id":"9a7e423c-dad6-4d2f-959b-1515a176188b","name":"Split into Items","type":"n8n-nodes-base.itemLists","typeVersion":3,"position":[-80,-64]},{"parameters":{"jsCode":"return items.map((item) => {\n const workflow = item.json;\n // Убираем спецсимволы из имени файла\n const safeName = workflow.name.replace(/[/\\\\?%*:|\"<>]/g, '-');\n \n // Кодируем ВЕСЬ объект воркфлоу в Base64\n const base64 = Buffer.from(JSON.stringify(workflow)).toString('base64');\n \n return {\n json: {\n safeName: safeName,\n base64Content: base64,\n today: new Date().toISOString().split('T')[0]\n }\n };\n});"},"id":"e62ffc50-788d-4ebd-96ba-e7e456617ef4","name":"Prepare Data (Base64)","type":"n8n-nodes-base.code","typeVersion":2,"position":[144,-64]},{"parameters":{"options":{}},"id":"40140d3a-3a99-4f4c-abaf-2c376fb6d3a9","name":"Loop (Split in Batches)","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[352,-64]},{"parameters":{"method":"POST","url":"=http://10.33.33.70:30008/api/v1/repos/ogrechko/n8n/contents/backups/{{ $json.today }}/{{ $json.safeName }}.json","authentication":"predefinedCredentialType","nodeCredentialType":"giteaApi","sendBody":true,"specifyBody":"json","jsonBody":"={\n \"content\": \"{{ $json.base64Content }}\",\n \"message\": \"Backup: {{ $json.safeName }}\",\n \"branch\": \"master\"\n}","options":{}},"id":"91ab5dc5-9ac9-4eed-9a1d-f811969bfeff","name":"Push to Gitea","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[576,-64],"credentials":{"giteaApi":{"id":"JpwYw1CY65zUadHB","name":"Gitea account"}}},{"parameters":{"amount":2},"id":"bfe90672-384c-4f7d-b783-0ee0f2082f2e","name":"Wait 2s","type":"n8n-nodes-base.wait","typeVersion":1.1,"position":[800,-64],"webhookId":"4113ef8c-8ada-4b32-acdb-8ba96426bd86"}],"connections":{"Schedule Trigger":{"main":[[{"node":"Get All Workflows","type":"main","index":0}]]},"Get All Workflows":{"main":[[{"node":"Split into Items","type":"main","index":0}]]},"Split into Items":{"main":[[{"node":"Prepare Data (Base64)","type":"main","index":0}]]},"Prepare Data (Base64)":{"main":[[{"node":"Loop (Split in Batches)","type":"main","index":0}]]},"Loop (Split in Batches)":{"main":[[{"node":"Send a text message","type":"main","index":0}],[{"node":"Push to Gitea","type":"main","index":0}]]},"Push to Gitea":{"main":[[{"node":"Wait 2s","type":"main","index":0}]]},"Wait 2s":{"main":[[{"node":"Loop (Split in Batches)","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","availableInMCP":false},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"7dc6e5ca-386c-450d-82a9-8dab29661d39","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-12-27T18:31:30.486Z","createdAt":"2025-12-27T18:31:30.486Z","role":"workflow:owner","workflowId":"BlRmzgPv0m7n7rCfoFaQE","projectId":"sYuiFAb87pAir6jV"}],"activeVersion":null,"tags":[]}
+1
View File
@@ -0,0 +1 @@
{"updatedAt":"2025-12-03T21:09:54.768Z","createdAt":"2025-12-03T20:47:48.689Z","id":"WNwF7L3mikoSfdwv","name":"pars_tg","active":false,"isArchived":false,"nodes":[{"parameters":{"options":{}},"type":"@n8n/n8n-nodes-langchain.chatTrigger","typeVersion":1.4,"position":[-480,-80],"id":"ece42184-9786-4fdd-8532-6ed6d3b412e3","name":"When chat message received","webhookId":"67c19089-9e45-4e3d-96db-390962f84509"},{"parameters":{"options":{"systemMessage":"=You are a smart agent\n\nToday's date is - {{ $now }}\n\nYour primary tool for generating responses is \"open and close tg\".\n\nAlways answer only based on these tools. [ ]\n\nAlways after the user's question, send a message using the tool - \"telegram tool\" stating that you have started the process and a response will be provided soon.\n\n1 Tool - \"open and close tg\"\nUse it when you need to parse data from the specified channel for any date in order to answer.\n\nChannel ID for parsing - -1001138673901\n\nBe sure to send the channel ID to this tool and formulate a prompt that can solve the user's request. Send the prompt along with the channel ID."}},"type":"@n8n/n8n-nodes-langchain.agent","typeVersion":3,"position":[-112,-96],"id":"1fe1c47f-2a4a-4a39-9e1f-0cfc14c9de04","name":"AI Agent"},{"parameters":{"contextWindowLength":500},"type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","typeVersion":1.3,"position":[-64,192],"id":"2a19bd8b-97a3-4066-8a4c-2bef14ac3bbb","name":"Simple Memory"},{"parameters":{"options":{}},"type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","typeVersion":1,"position":[-272,128],"id":"0a7bf2fa-c60a-497e-8b0b-94c670048417","name":"OpenRouter Chat Model","credentials":{"openRouterApi":{"id":"zF58stjgF5xdkTLm","name":"OpenRouter account"}}},{"parameters":{"description":"you should go in this tool if you need data on telegram chanell (closed and opened)","workflowId":{"__rl":true,"value":"Hx3uO2aSTDEtCIWj","mode":"list","cachedResultUrl":"/workflow/Hx3uO2aSTDEtCIWj","cachedResultName":"pars_tg2"},"workflowInputs":{"mappingMode":"defineBelow","value":{},"matchingColumns":[],"schema":[],"attemptToConvertTypes":false,"convertFieldsToString":false}},"type":"@n8n/n8n-nodes-langchain.toolWorkflow","typeVersion":2.2,"position":[208,192],"id":"11a57857-034a-44ab-8ff8-92d1d256b552","name":"open and close tg"}],"connections":{"When chat message received":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"OpenRouter Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"open and close tg":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"2d12300a-0eaa-4165-8807-c3c40472b97b","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-12-03T20:47:48.689Z","createdAt":"2025-12-03T20:47:48.689Z","role":"workflow:owner","workflowId":"WNwF7L3mikoSfdwv","projectId":"sYuiFAb87pAir6jV"}],"activeVersion":null,"tags":[]}
+1
View File
@@ -0,0 +1 @@
{"updatedAt":"2025-12-03T21:09:16.854Z","createdAt":"2025-12-03T20:55:08.726Z","id":"Hx3uO2aSTDEtCIWj","name":"pars_tg2","active":false,"isArchived":false,"nodes":[{"parameters":{"inputSource":"passthrough"},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[-320,-48],"id":"66d86dac-706e-49ae-afdb-1f8a5dcdae95","name":"When Executed by Another Workflow"},{"parameters":{"promptType":"define","text":"={{ $json.query }}","options":{"systemMessage":"=You are a smart assistant, whose sole task is to correctly form a link depending on the user's request, send it to the tool – Request, receive a selection of posts from this tool, and then send it further in the form of a brief summary.\n\nTo form the link, use the following data:\nLink format – http://5.181.20.197:3000/parse?channel={channel}&limit={limit}&offsetDate={date}\n\nWhere the following parameters need to be substituted:\n{channel} - channel id\n{limit} - a number indicating the number of posts to parse\n{date} - a number indicating the required date from which to start parsing, for example 2025-05-15 (This is May 15, 2025)\n{channel} - provided to us by the user\n{limit} - You must decide for yourself how many posts to get\n{date} - The date starting from which we parse posts backwards\n\nWe receive posts in the following format:\n{\n\"id\": 1575162,\n\"text\": \"Here is the post text\",\n\"date\": 1747671550\n}\n\nThe post date comes in UNIX timestamp format in seconds (not milliseconds), for example: 1747733735. Use UTC when converting. Convert such numbers to ISO or YYYY-MM-DD format correctly.\n\nExample of a formed link for passing to the tool – Request:\n\n\"http://5.181.20.197:3000/parse?channel=1577983092&limit=10&offsetDate=2025-05-15\""}},"type":"@n8n/n8n-nodes-langchain.agent","typeVersion":3,"position":[-112,-48],"id":"2e7c5107-d612-4454-88d0-da05254d0e8c","name":"AI Agent"},{"parameters":{"options":{}},"type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","typeVersion":1,"position":[-256,160],"id":"00b513a6-547d-4c4a-b929-5a68529326db","name":"OpenRouter Chat Model","credentials":{"openRouterApi":{"id":"zF58stjgF5xdkTLm","name":"OpenRouter account"}}},{"parameters":{"sessionIdType":"customKey","sessionKey":"={{ $json.query }}","contextWindowLength":500},"type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","typeVersion":1.3,"position":[-112,160],"id":"d78c52b3-e9a2-429c-8e30-5f59032d3205","name":"Simple Memory"},{"parameters":{"toolDescription":"=Your task is to substitute the following data into the link http://5.181.20.197:3000/parse?channel={channel}&limit={limit}&offsetDate={date} \n\n{channel} - channel id\n{limit} - a number indicating the number of posts to parse\n{date} - a number indicating the date from which to start parsing","url":"http://5.181.20.197:3000/parse?channel={channel}&limit={limit}&offsetDate={date}","options":{}},"type":"n8n-nodes-base.httpRequestTool","typeVersion":4.3,"position":[144,160],"id":"7d4f02db-67f0-403f-bc90-95d8288b3deb","name":"Request"}],"connections":{"When Executed by Another Workflow":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"OpenRouter Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Request":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"a98f78a4-889a-4e5e-aa96-8e9716bdfc06","activeVersionId":null,"triggerCount":0,"shared":[{"updatedAt":"2025-12-03T20:55:08.726Z","createdAt":"2025-12-03T20:55:08.726Z","role":"workflow:owner","workflowId":"Hx3uO2aSTDEtCIWj","projectId":"sYuiFAb87pAir6jV"}],"activeVersion":null,"tags":[]}
+1
View File
@@ -0,0 +1 @@
{"updatedAt":"2025-11-30T14:49:06.937Z","createdAt":"2025-11-30T14:22:03.470Z","id":"jZIoYr8RW41K0j4J","name":"tg_callbacks","active":false,"isArchived":false,"nodes":[{"parameters":{"content":"# нажал ДА = ВЫБЕРИ ВЕС","height":292,"width":1178,"color":4},"id":"8cbb64b7-c351-4b48-8870-6c6ec65498c7","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[0,448],"typeVersion":1},{"parameters":{"updates":["*"],"additionalFields":{}},"type":"n8n-nodes-base.telegramTrigger","typeVersion":1.2,"position":[-624,1152],"id":"de564fd6-34c6-4a15-acbb-416dcb225a40","name":"Telegram Trigger","webhookId":"e4d6b058-dc8c-4130-9abd-41243518e824","credentials":{"telegramApi":{"id":"R8VDF53JH3mzhoHd","name":"Telegram dieta"}}},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"52493568-0b68-46b8-b18a-894cf77bcac1","leftValue":"={{$json.callback_query.data}}","rightValue":"manual_","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"},"renameOutput":true,"outputKey":"manual"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"5eeb9b3f-d4ce-45f6-bb62-32244fd9a99a","leftValue":"={{ $json.message.photo[0] }}","rightValue":"","operator":{"type":"object","operation":"exists","singleValue":true}}],"combinator":"and"},"renameOutput":true,"outputKey":"image"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"2f1495ad-2eb2-4729-af5a-23c949adce8c","leftValue":"={{$json.callback_query.data}}","rightValue":"dish_yes_","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"},"renameOutput":true,"outputKey":"dish_yes"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"leftValue":"={{$json.callback_query.data}}","rightValue":"dish_no_","operator":{"type":"string","operation":"startsWith"},"id":"c9ead52e-1b81-453a-bd9b-1d18dcbd82bb"}],"combinator":"and"},"renameOutput":true,"outputKey":"dish_no"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"646db5d3-3518-4edf-9374-cef371fa7ba9","leftValue":"={{$json.callback_query.data}}","rightValue":"alt_","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"},"renameOutput":true,"outputKey":"alt"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"1bcf1e75-3e73-465b-8bbb-2665b845e7e9","leftValue":"={{$json.callback_query.data}}","rightValue":"weight_","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"},"renameOutput":true,"outputKey":"weight"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"90573faf-164a-418f-a4a8-b69d3e7aaf3d","leftValue":"={{$json.callback_query.data}}","rightValue":"cancel_","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"},"renameOutput":true,"outputKey":"cancel"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"6166763a-38e9-494a-aea0-20bdc9626314","leftValue":"={{ $json.message.text }}","rightValue":"/","operator":{"type":"string","operation":"exists","singleValue":true}}],"combinator":"and"},"renameOutput":true,"outputKey":"text_cmd"}]},"options":{}},"type":"n8n-nodes-base.switch","typeVersion":3.2,"position":[-416,1040],"id":"77416214-f1c4-4160-ae59-2c266ceec40b","name":"Switch"},{"parameters":{"jsCode":"// alt_0_7 → parts = ['alt','0','7']\nconst [, idx, id] = $json.callback_query.data.split('_');\n\nreturn [{\n json: {\n chat_id : $json.callback_query.message.chat.id, // ID чата, где лежит сообщение-клавиатура\n draft_id : Number(id), // 7\n alt_idx : Number(idx), // 0 / 1 / 2\n del_msg_id : $json.callback_query.message.message_id // ID сообщения, которое надо удалить\n }\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[64,1168],"id":"f0f7a047-5dd6-47e0-b420-22f1d2d4b244","name":"Parse alt"},{"parameters":{"operation":"get","tableId":"meals_draft","filters":{"conditions":[{"keyName":"chat_id","keyValue":"={{$json.chat_id}}"},{"keyName":"message_id","keyValue":"={{$json.draft_id}}"},{"keyName":"status","keyValue":"await_alt"}]}},"type":"n8n-nodes-base.supabase","typeVersion":1,"position":[448,1168],"id":"dc33c3e0-b25b-415d-bef5-8fd1eb637e90","name":"GET 3","credentials":{"supabaseApi":{"id":"OoOx3pPUNd1lRJTr","name":"Supabase account"}}},{"parameters":{"operation":"update","tableId":"meals_draft","filters":{"conditions":[{"keyName":"chat_id","condition":"eq","keyValue":"={{ $json.chat_id }Line truncated
+1
View File
@@ -0,0 +1 @@
{"updatedAt":"2025-11-30T14:45:15.046Z","createdAt":"2025-11-30T14:22:55.223Z","id":"kohwX0oaY0hmL9b2","name":"tx_text","active":false,"isArchived":false,"nodes":[{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"0a73cab2-d78a-4354-a626-2fa054d2426a","leftValue":"={{ $json.message.text }}","rightValue":"/start","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"},"renameOutput":true,"outputKey":"start"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"leftValue":"={{ $json.message.text }}","rightValue":"/v","operator":{"type":"string","operation":"startsWith"},"id":"c83a3bbf-a07a-4547-aa5f-24d1641dc2fe"}],"combinator":"and"},"renameOutput":true,"outputKey":"main"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"fa47404d-c110-4d4a-8310-126eb004bd75","leftValue":"={{ $json.message.text }}","rightValue":"/","operator":{"type":"string","operation":"notStartsWith"}}],"combinator":"and"},"renameOutput":true,"outputKey":"chat"}]},"options":{}},"type":"n8n-nodes-base.switch","typeVersion":3.2,"position":[-4128,624],"id":"c9164468-42e2-475b-ae89-1f30d90d4cd8","name":"Switch"},{"parameters":{"jsCode":"const chatId = $items('extract')[0].json.chat_id;\nconst src = JSON.parse($json.message.content); // {\"dish\":..,\"grams\":..[, \"time\":\"HH:MM\"]}\n\n// ── московская «сегодня»\nconst now = new Date(new Date().toLocaleString('en-US',{ timeZone:'Europe/Moscow' }));\n\n// берём HH:MM из src.time или текущее\nlet [hh, mm] =\n src.time?.match(/^(\\d{2}):(\\d{2})$/)?.slice(1) ||\n [now.getHours(), now.getMinutes()].map(n => String(n).padStart(2,'0'));\n\n// собираем ISO-строку в МСК (+03:00) — без перевода в UTC\nconst pad = n => String(n).padStart(2,'0');\nconst eatenAt = `${now.getFullYear()}-${pad(now.getMonth()+1)}-${pad(now.getDate())}` +\n `T${hh}:${mm}:00+03:00`;\n\nreturn [{\n json: {\n chat_id : chatId,\n dish : src.dish,\n grams : src.grams,\n eaten_at: eatenAt\n }\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-3024,64],"id":"bc17ee36-1ac2-4392-aad1-fba77291cdc4","name":"parseJSON"},{"parameters":{"inputSource":"passthrough"},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[-4432,624],"id":"67bd015d-9cdc-42c8-978f-13b436d9ffee","name":"When Executed by Another Workflow"},{"parameters":{"jsCode":"const text = $json.message.text.replace(/^\\/v\\s+/i, '');\nreturn [{ json: { chat_id: $json.message.chat.id, raw: text } }];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[-3792,144],"id":"1a8628d9-70b1-4986-ab3a-67127dae4dad","name":"extract"},{"parameters":{"modelId":{"__rl":true,"value":"gpt-4o-mini","mode":"list","cachedResultName":"GPT-4O-MINI"},"messages":{"values":[{"content":"=Ты нутри-калькулятор.\nНа вход одна строка «dish, grams».\nВерни ТОЛЬКО одну строку JSON:\n{\"dish\":\"…\",\"kcal\":число,\"prot\":число,\"fat\":число,\"carb\":число}\nБез ``` и без пояснений.","role":"system"},{"content":"={{ $json.dish }}, {{ $json.grams }}"}]},"jsonOutput":true,"options":{}},"type":"@n8n/n8n-nodes-langchain.openAi","typeVersion":1.8,"position":[-2800,64],"id":"b59fbfc7-0ef2-4343-bd3a-9d278c66baa4","name":"nutrion","credentials":{"openAiApi":{"id":"PvUURuR361IXH0ve","name":"OpenAi account"}}},{"parameters":{"modelId":{"__rl":true,"value":"gpt-4o-mini","mode":"list","cachedResultName":"GPT-4O-MINI"},"messages":{"values":[{"content":"Ты нутри-парсер.\n\nПолучаешь одну строку с описанием еды, которую ел человек и время употребления.\n\n- Если можешь разумно оценить порцию и массу (число граммов) — даже по словам типа «1 шт», «половина», «два куска» — верни ОДНУ строку JSON:\n\n{\"dish\":\"…\",\"grams\":число[, \"time\":\"HH:MM\"]}\n\n- time указывай, только если нашёл в тексте, без даты.\n\n- Если оценить порцию или время нельзя — верни ТЕКСТ-подсказку:\n*Не распознал* 🤔\n\n*Формат:* /v блюдо граммы [HH:MM]\n*Пример:* /v яблоко 100г 18:00","role":"system"},{"content":"={{ $json.raw }}"}]},"options":{}},"type":"@n8n/n8n-nodes-langchain.openAi","typeVersion":1.8,"position":[-3584,144],"id":"f6bfff2b-d314-4711-9270-955298485482","name":"parser","credentials":{"openAiApi":{"id":"PvUURuR361IXH0ve","name":"OpenAi account"}}},{"parameters":{"content":"# /v РУЧНОЙ ВLine truncated