-
Notifications
You must be signed in to change notification settings - Fork 2
/
telegram-ai-chatbot-gMo8E1HilXUzCU5y.json
1 lines (1 loc) · 7.03 KB
/
telegram-ai-chatbot-gMo8E1HilXUzCU5y.json
1
{"createdAt":"2023-09-28T10:59:05.864Z","updatedAt":"2023-09-28T11:10:35.437Z","id":"gMo8E1HilXUzCU5y","name":"Telegram AI Chatbot","active":false,"nodes":[{"parameters":{"updates":["*"],"additionalFields":{}},"id":"ea71a467-a646-4aca-b72e-cef1249c74e2","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[380,240],"webhookId":"51942fbb-ca0e-4ec4-9423-5fcc7d3c4281","typeVersion":1,"credentials":{"telegramApi":{"id":"sTd6UinHeRVEv74q","name":"Telegram account"}}},{"parameters":{"dataType":"string","value1":"={{ $json.message?.text }}","rules":{"rules":[{"operation":"notStartsWith","value2":"/"},{"operation":"startsWith","value2":"/start","output":1},{"operation":"startsWith","value2":"=/image ","output":2}]},"fallbackOutput":3},"id":"1cbe43d4-ea8b-4178-bc10-4bfad7abe143","name":"CheckCommand","type":"n8n-nodes-base.switch","position":[1340,260],"typeVersion":1},{"parameters":{"content":"## Error fallback for unsupported commands","height":231.22373949579838,"width":316.1071428571428},"id":"074e907f-634b-4242-b669-33fa064f8472","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[1960,481.661764705882],"typeVersion":1},{"parameters":{"values":{"number":[{"name":"model_temperature","value":0.8},{"name":"token_length","value":500}],"string":[{"name":"system_command","value":"=You are a friendly chatbot. User name is {{ $json?.message?.from?.first_name }}. User system language is {{ $json?.message?.from?.language_code }}. First, detect user text language. Next, provide your reply in the same language. Include several suitable emojis in your answer."},{"name":"bot_typing","value":"={{ $json?.message?.text.startsWith('/image') ? \"upload_photo\" : \"typing\" }}"}]},"options":{}},"id":"2aa961b8-f0af-4d5c-a6af-1be56ea4b2e6","name":"Settings","type":"n8n-nodes-base.set","position":[740,240],"typeVersion":2},{"parameters":{"content":"## Chatbot mode by default\n### (when no command is provided)","height":233,"width":330.5019024637719},"id":"2d2fe268-1e3e-483b-847c-4412e586c1ca","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[1600,-340],"typeVersion":1},{"parameters":{"content":"## Welcome message\n### /start","height":219.892857142857,"width":330.7863484403046},"id":"09a9c0b4-ac6e-46eb-b2e0-ef2b55e94ada","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1600,-80],"typeVersion":1},{"parameters":{"resource":"chat","model":"gpt-4","prompt":{"messages":[{"role":"system","content":"={{ $json.system_command }}"},{"content":"={{ $json.message.text }}"}]},"options":{"maxTokens":"={{ $json.token_length }}","temperature":"={{ $json.model_temperature }}"}},"id":"088cffee-5720-488b-a4ec-cfdccbf77e75","name":"Chat_mode","type":"n8n-nodes-base.openAi","position":[1700,-260],"typeVersion":1,"credentials":{"openAiApi":{"id":"TLWOaEfpEHr1WC0E","name":"OpenAI API"}}},{"parameters":{"resource":"chat","prompt":{"messages":[{"role":"system","content":"={{ $json.system_command }}"},{"content":"=This is the first message from a user. Please welcome a new user in `{{ $json.message.from.language_code }}` language"}]},"options":{"maxTokens":"={{ $json.token_length }}","temperature":"={{ $json.model_temperature }}"}},"id":"41248697-6474-4a8f-a8b8-038c96465948","name":"Greeting","type":"n8n-nodes-base.openAi","position":[1700,-20],"typeVersion":1,"credentials":{"openAiApi":{"id":"TLWOaEfpEHr1WC0E","name":"OpenAI API"}}},{"parameters":{"chatId":"={{ $('Settings').first().json.message.from.id }}","text":"={{ $json.message.content }}","additionalFields":{"parse_mode":"Markdown"}},"id":"20c2e7fa-5d65-441b-8d1d-a8d46c624964","name":"Text reply","type":"n8n-nodes-base.telegram","position":[2060,-140],"typeVersion":1,"credentials":{"telegramApi":{"id":"sTd6UinHeRVEv74q","name":"Telegram account"}}},{"parameters":{"operation":"sendChatAction","chatId":"={{ $json.message.from.id }}","action":"={{ $json.bot_typing }}"},"id":"30321276-ebe1-41ac-b420-9dab8daa405b","name":"Send Typing action","type":"n8n-nodes-base.telegram","position":[940,380],"typeVersion":1,"credentials":{"telegramApi":{"id":"sTd6UinHeRVEv74q","name":"Telegram account"}}},{"parameters":{"mode":"chooseBranch"},"id":"7d7ff2e8-b0ca-4638-a056-f7b4e2e6273d","name":"Merge","type":"n8n-nodes-base.merge","position":[1160,260],"typeVersion":2.1},{"parameters":{"content":"## Create an image\n### /image + request","height":233.8785714285713,"width":329.7428571428562},"id":"656bab5e-b7f7-47a1-8e75-4a17d2070290","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[1600,180],"typeVersion":1},{"parameters":{"resource":"image","prompt":"={{ $json.message.text.split(' ').slice(1).join(' ') }}","responseFormat":"imageUrl","options":{"n":1,"size":"512x512"}},"id":"ca2111d2-463a-4ef0-9436-ee09598dbf07","name":"Create an image","type":"n8n-nodes-base.openAi","position":[1700,260],"typeVersion":1,"credentials":{"openAiApi":{"id":"TLWOaEfpEHr1WC0E","name":"OpenAI API"}}},{"parameters":{"chatId":"={{ $json.message.from.id }}","text":"=Sorry, {{ $json.message.from.first_name }}! This command is not supported yet. Please type some text to a chat bot or try this command:\n/image \\[your prompt]\n\nEnter the command, then space and provide your request. Example:\n\n`/image a picture or a cute little kitten with big eyes. Miyazaki studio ghibli style`","additionalFields":{"parse_mode":"Markdown"}},"id":"e91d616b-1d5e-40e8-8468-2d0b2dda4cf7","name":"Send error message","type":"n8n-nodes-base.telegram","position":[2060,560],"typeVersion":1},{"parameters":{"operation":"sendPhoto","chatId":"={{ $('Settings').first().json.message.from.id }}","file":"={{ $json.url }}","additionalFields":{}},"id":"125e27d2-b03b-4f02-9dd1-8fc81ecf0b6b","name":"Send image","type":"n8n-nodes-base.telegram","position":[2060,260],"typeVersion":1,"credentials":{"telegramApi":{"id":"sTd6UinHeRVEv74q","name":"Telegram account"}}},{"parameters":{"values":{"string":[{"name":"message.text","value":"={{ $json?.message?.text || \"\" }}"}]},"options":{"dotNotation":true}},"id":"730a51ac-223e-4956-be7f-166eadb6ed81","name":"PreProcessing","type":"n8n-nodes-base.set","position":[560,240],"typeVersion":2}],"connections":{"Merge":{"main":[[{"node":"CheckCommand","type":"main","index":0}]]},"Greeting":{"main":[[{"node":"Text reply","type":"main","index":0}]]},"Settings":{"main":[[{"node":"Send Typing action","type":"main","index":0},{"node":"Merge","type":"main","index":0}]]},"Chat_mode":{"main":[[{"node":"Text reply","type":"main","index":0}]]},"CheckCommand":{"main":[[{"node":"Chat_mode","type":"main","index":0}],[{"node":"Greeting","type":"main","index":0}],[{"node":"Create an image","type":"main","index":0}],[{"node":"Send error message","type":"main","index":0}]]},"PreProcessing":{"main":[[{"node":"Settings","type":"main","index":0}]]},"Create an image":{"main":[[{"node":"Send image","type":"main","index":0}]]},"Telegram Trigger":{"main":[[{"node":"PreProcessing","type":"main","index":0}]]},"Send Typing action":{"main":[[{"node":"Merge","type":"main","index":1}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"dff30b77-2977-4ba8-92b9-acbcc2574182","triggerCount":0,"tags":[]}