feat: first commit
This commit is contained in:
@@ -0,0 +1,183 @@
|
||||
[
|
||||
{
|
||||
"updatedAt": "2026-05-10T04:59:55.823Z",
|
||||
"createdAt": "2026-05-10T02:56:17.579Z",
|
||||
"id": "rauwyTPZAO3vIgxj",
|
||||
"name": "Dyak — Чат с помощником",
|
||||
"description": null,
|
||||
"active": true,
|
||||
"isArchived": false,
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "ask-chat",
|
||||
"responseMode": "responseNode",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 2.1,
|
||||
"position": [
|
||||
1456,
|
||||
368
|
||||
],
|
||||
"id": "e049dc5e-c6ed-4c08-b6fa-b26a26e78384",
|
||||
"name": "Webhook",
|
||||
"webhookId": "dyak-ask-chat"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Готовим payload для Ollama /api/chat:\n// {model, messages: [{role, content}, ...], stream: false, options: {num_ctx}}\n// Принимаем body как с верхнего уровня ($json), так и из $json.body —\n// поведение n8n меняется в зависимости от версии и заголовков.\nconst src = $input.first().json;\nconst body = src.body || src;\n\nconst system = (body.system || '').toString();\nconst history = Array.isArray(body.messages) ? body.messages : [];\nconst model = body.model || 'qwen2.5:32b';\n\nconst messages = [];\nif (system) {\n messages.push({ role: 'system', content: system });\n}\nfor (const m of history) {\n if (m && m.role && typeof m.content === 'string' && m.content.length > 0) {\n messages.push({ role: m.role, content: m.content });\n }\n}\n\nreturn [{\n json: {\n model,\n messages,\n stream: false,\n options: { num_ctx: 16384, temperature: 0.5 }\n }\n}];\n"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1680,
|
||||
368
|
||||
],
|
||||
"id": "d74becc0-cd53-407d-8940-cd5d928b58cc",
|
||||
"name": "Подготовка payload"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "http://ollama-gpu:11434/api/chat",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={{ JSON.stringify($json) }}",
|
||||
"options": {
|
||||
"response": {
|
||||
"response": {
|
||||
"responseFormat": "json"
|
||||
}
|
||||
},
|
||||
"timeout": 600000
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.2,
|
||||
"position": [
|
||||
1920,
|
||||
368
|
||||
],
|
||||
"id": "92a4820e-a8fb-4f28-be74-8caae884a1d3",
|
||||
"name": "Ollama: /api/chat"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Приводим ответ Ollama к контракту, который ждёт dyak.api.v1.chat:\n// [{content: \"...\"}]\n// Ollama /api/chat возвращает {message: {role, content}, ...}.\nconst raw = $input.first().json;\nconst content = raw && raw.message && raw.message.content\n ? raw.message.content\n : '';\n\nreturn [{ json: { content } }];\n"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
2160,
|
||||
368
|
||||
],
|
||||
"id": "0b7871c2-10a6-4c1f-af9b-2eae01d4e8e0",
|
||||
"name": "Извлечение content"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"respondWith": "allIncomingItems",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1.5,
|
||||
"position": [
|
||||
2400,
|
||||
368
|
||||
],
|
||||
"id": "9222a8e2-e450-4146-913d-837c59b497bc",
|
||||
"name": "Respond to Webhook"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Подготовка payload",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Подготовка payload": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Ollama: /api/chat",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Ollama: /api/chat": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Извлечение content",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Извлечение content": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Respond to Webhook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"executionOrder": "v1",
|
||||
"binaryMode": "separate"
|
||||
},
|
||||
"staticData": null,
|
||||
"meta": null,
|
||||
"pinData": {},
|
||||
"versionId": "1c17ade8-ecfe-4e8d-99cf-9732693d0775",
|
||||
"activeVersionId": "1c17ade8-ecfe-4e8d-99cf-9732693d0775",
|
||||
"versionCounter": 27,
|
||||
"triggerCount": 1,
|
||||
"tags": [
|
||||
{
|
||||
"updatedAt": "2026-05-08T13:58:35.970Z",
|
||||
"createdAt": "2026-05-08T13:58:35.970Z",
|
||||
"id": "am4wleG98HrE7SAc",
|
||||
"name": "dyak"
|
||||
}
|
||||
],
|
||||
"shared": [
|
||||
{
|
||||
"updatedAt": "2026-05-10T02:56:17.579Z",
|
||||
"createdAt": "2026-05-10T02:56:17.579Z",
|
||||
"role": "workflow:owner",
|
||||
"workflowId": "rauwyTPZAO3vIgxj",
|
||||
"projectId": "ADyfwlKMDdTKeTb1",
|
||||
"project": {
|
||||
"updatedAt": "2026-05-08T12:50:32.745Z",
|
||||
"createdAt": "2026-05-08T04:19:48.389Z",
|
||||
"id": "ADyfwlKMDdTKeTb1",
|
||||
"name": "vladimir bolshakovsky <vladimir@bolshakovsky.ru>",
|
||||
"type": "personal",
|
||||
"icon": null,
|
||||
"description": null,
|
||||
"creatorId": "4b15ec28-0ec1-4822-85a6-86b4929930aa"
|
||||
}
|
||||
}
|
||||
],
|
||||
"versionMetadata": {
|
||||
"name": "Version 1c17ade8",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user