Commit eeb89845 authored by 马超's avatar 马超

Upload New File

parent 477328da
{
"createdAt": "2024-09-12T09:04:59.778Z",
"updatedAt": "2024-09-12T10:08:13.000Z",
"id": "SSRzCtHJmpoNsal7",
"name": "myworkflow",
"active": false,
"nodes": [
{
"parameters": {
"table": {
"__rl": true,
"value": "city_safe_guide",
"mode": "list",
"cachedResultName": "city_safe_guide"
},
"options": {}
},
"id": "3897d8b1-7614-45ff-9aa5-a6cc289973ac",
"name": "MySQL",
"type": "n8n-nodes-base.mySql",
"typeVersion": 2.4,
"position": [
1200,
160
],
"credentials": {
"mySql": {
"id": "09oRI0DULmEzD9l8",
"name": "MySQL account"
}
}
},
{
"parameters": {
"collection": "results_ls_fww",
"options": {},
"query": "{ \"schedule_id\": \"20\"}"
},
"id": "844aced7-ac0f-414e-a8d9-8f3973ebfb3a",
"name": "MongoDB",
"type": "n8n-nodes-base.mongoDb",
"typeVersion": 1.1,
"position": [
40,
80
],
"credentials": {
"mongoDb": {
"id": "D2GwCG2UAtnWPY8f",
"name": "MongoDB account"
}
}
},
{
"parameters": {
"path": "e495a29c-8f43-4175-bdb8-277e03b60b07",
"options": {}
},
"id": "c5626b71-d366-4b9b-9239-aacdecefdb5b",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
-120,
80
],
"webhookId": "e495a29c-8f43-4175-bdb8-277e03b60b07"
},
{
"parameters": {
"method": "POST",
"url": "http://47.99.137.247/v1/completion-messages",
"sendHeaders": true,
"specifyHeaders": "json",
"jsonHeaders": "{\n \"Authorization\": \"Bearer app-ApuLSwN3ahfsL3CVAyKs3F0s\",\n \"Content-Type\": \"application/json\"\n}",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"inputs\": {\"query\":\"{{ $json.info.replaceAll(/[ \\t\\n\\r]+/g, '')}} 请将上述内容按照以下json格式输出,并需要符合json schema规范 {{ JSON.stringify($json.attr).replaceAll(/\"/g, '\\'')}}\"},\n \"response_mode\": \"blocking\",\n \"user\": \"mc\"\n}",
"options": {}
},
"id": "de50700e-6d6c-427f-9fa7-6e05e81780fd",
"name": "dify",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
520,
-100
]
},
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nlet output_info = {};\ninfo = (JSON.parse($input.item.json.content)).实用信息;\noutput_info['info'] = info;\nreturn output_info;"
},
"id": "b1159cc1-1d2e-4ddb-b999-87c816c6405c",
"name": "content",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
280,
80
]
},
{
"parameters": {
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\noutput_all = {};\noutput_data = {};\noutput_name_id = {};\nfor (const item of $input.all()) {\n output_data[item.json.name_cn] = \"xxx\";\n output_name_id[item.json.name_cn] = item.json.id;\n}\noutput_all['attr'] = output_data;\noutput_all['attr_id'] = output_name_id;\nreturn output_all;"
},
"id": "8833489f-a3d3-4fdf-a249-2912b818416a",
"name": "attribute",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
40,
-120
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "select id,name_cn from code a where group_id = '10' and status = '0';",
"options": {}
},
"id": "194726be-688f-448c-b5f2-d28952258be8",
"name": "attribute_sql",
"type": "n8n-nodes-base.mySql",
"typeVersion": 2.4,
"position": [
-120,
-120
],
"credentials": {
"mySql": {
"id": "09oRI0DULmEzD9l8",
"name": "MySQL account"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "select location from schedule a where a.id = {{$json.schedule_id}}\n",
"options": {}
},
"id": "74d2db72-a3c9-434f-94ba-d5098f83756b",
"name": "location_sql",
"type": "n8n-nodes-base.mySql",
"typeVersion": 2.4,
"position": [
60,
320
],
"credentials": {
"mySql": {
"id": "09oRI0DULmEzD9l8",
"name": "MySQL account"
}
}
},
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nresult_data = $input.item.json;\nlocation_data_list = JSON.parse(result_data.location);\nanswer_data = JSON.parse(result_data.answer);\nattr_id_data = JSON.parse(result_data.attr_id);\n_output_all = [];\nfor (let i = 0; i < location_data_list.length; i++) {\n cityCode = location_data_list[i].cityCode;\n for (let key in answer_data) {\n if (jsonData.hasOwnProperty(key)) { // 确保key是对象自身的属性\n console.log(key + \": \" + answer_data[key]);\n data_item = {};\n data_item['city_code'] = cityCode;\n data_item['recommend'] = JSON.stringify(answer_data[key]);\n data_item['classification_id'] = attr_id_data[key];\n _output_all.append(data_item);\n }\n }\n}\nreturn _output_all;"
},
"id": "c737a69f-0163-47bd-b863-70d7501187e7",
"name": "result",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
920,
160
]
},
{
"parameters": {
"method": "POST",
"url": "http://47.99.137.247/v1/completion-messages",
"sendHeaders": true,
"specifyHeaders": "json",
"jsonHeaders": "{\n \"Authorization\": \"Bearer app-ApuLSwN3ahfsL3CVAyKs3F0s\",\n \"Content-Type\": \"application/json\"\n}",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"inputs\": {\"query\":\"{{ $json.info.replaceAll(/[ \\t\\n\\r]+/g, '')}} 请将上述内容按照以下json格式输出,并需要符合json schema规范 {{ JSON.stringify($json.attr).replaceAll(/\"/g, '\\'')}}\"},\n \"response_mode\": \"blocking\",\n \"user\": \"mc\"\n}",
"options": {}
},
"id": "fc981c2b-2d5e-4efa-9112-51b3dd45dae0",
"name": "dify1",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1500,
-740
]
},
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nresult_data_json = {\n \"meta\": {\n \"instanceId\": \"ece0f5d11a08367ce2b9a54872effc3097e741a5f11c32cdaf18af6d780d6a56\"\n },\n \"nodes\": [\n {\n \"parameters\": {\n \"mode\": \"runOnceForEachItem\",\n \"jsCode\": \"// Loop over input items and add a new field called 'myNewField' to the JSON of each one\\nlocation_data_list = $input.item.json;\\nfor (let i = 0; i < location_data_list.length; i++) {\\n cityCode = location_data_list[i].cityCode;\\n \\n}\"\n },\n \"id\": \"c737a69f-0163-47bd-b863-70d7501187e7\",\n \"name\": \"result\",\n \"type\": \"n8n-nodes-base.code\",\n \"typeVersion\": 2,\n \"position\": [\n 900,\n 260\n ]\n }\n ],\n \"connections\": {},\n \"pinData\": {}\n}\nresult_data = {};\nresult_data['answer'] = result_data_json;\nreturn result_data;"
},
"id": "aa3a70a6-8194-49fb-bece-3ca78ce03807",
"name": "result1",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
640,
-260
]
},
{
"parameters": {
"mode": "combineBySql",
"numberInputs": 3
},
"id": "56ead3e5-fd33-4d83-b469-5d749f646602",
"name": "Merge2",
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
1060,
-40
]
},
{
"parameters": {
"mode": "combineBySql"
},
"id": "b67162e6-cc85-4519-8d9c-ac8edefa9f33",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
280,
-100
]
},
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\n//answer = \"```json{\\\"test1\\\":\\\"test\\\"}```\";\nfunction findAllIndexes(str, charToFind) {\n const regex = new RegExp(charToFind, 'g');\n let indexes = [];\n let result;\n while ((result = regex.exec(str)) !== null) {\n indexes.push(result.index);\n }\n return indexes;\n}\nanswer = $input.item.json.answer;\nindexes = findAllIndexes(answer,\"```\");\nconsole.log(indexes[0]);\nanswer_data_json = JSON.parse(answer.slice(indexes[0]+7, indexes[1]));\nconsole.log(answer_data);\nanswer_data = {\"answer\":answer_data_json};\nreturn answer_data;"
},
"id": "debaa6fe-dfcc-479b-9297-0482ec381f2b",
"name": "answer",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
740,
-100
]
},
{
"parameters": {
"mode": "combineBySql",
"numberInputs": 3,
"query": "SELECT * FROM (SELECT * FROM input1 LEFT JOIN input2 ON input1.name = input2.id) as input1_1 LEFT JOIN input3 ON input1_1.name = input3.id"
},
"id": "b90aad45-fd1c-41ad-a960-fe35464b4928",
"name": "Merge1",
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
600,
160
]
}
],
"connections": {
"MongoDB": {
"main": [
[
{
"node": "content",
"type": "main",
"index": 0
},
{
"node": "attribute_sql",
"type": "main",
"index": 0
},
{
"node": "location_sql",
"type": "main",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "MongoDB",
"type": "main",
"index": 0
}
]
]
},
"content": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"attribute": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"attribute_sql": {
"main": [
[
{
"node": "attribute",
"type": "main",
"index": 0
}
]
]
},
"dify": {
"main": [
[
{
"node": "answer",
"type": "main",
"index": 0
}
]
]
},
"location_sql": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 1
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 0
},
{
"node": "dify",
"type": "main",
"index": 0
}
]
]
},
"answer": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 0
}
]
]
},
"Merge1": {
"main": [
[
{
"node": "result",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {},
"staticData": null,
"meta": {
"templateCredsSetupCompleted": true
},
"pinData": {},
"versionId": "da109e58-1c03-4b64-bd34-e3b84d841d02",
"triggerCount": 0,
"shared": [
{
"createdAt": "2024-09-12T09:04:59.787Z",
"updatedAt": "2024-09-12T09:04:59.787Z",
"role": "workflow:owner",
"workflowId": "SSRzCtHJmpoNsal7",
"projectId": "C7zKoCDdmGgzUqSW",
"project": {
"createdAt": "2024-08-23T06:31:21.275Z",
"updatedAt": "2024-08-23T06:41:43.608Z",
"id": "C7zKoCDdmGgzUqSW",
"name": "周 卫 <zhouwei@ssish.com>",
"type": "personal",
"projectRelations": [
{
"createdAt": "2024-08-23T06:31:21.275Z",
"updatedAt": "2024-08-23T06:31:21.275Z",
"role": "project:personalOwner",
"userId": "3f0021b4-d0a7-4db6-af21-5ef829c47882",
"projectId": "C7zKoCDdmGgzUqSW",
"user": {
"createdAt": "2024-08-23T06:31:16.119Z",
"updatedAt": "2025-03-19T06:19:26.514Z",
"id": "3f0021b4-d0a7-4db6-af21-5ef829c47882",
"email": "zhouwei@ssish.com",
"firstName": "周",
"lastName": "卫",
"personalizationAnswers": {
"companyType": "education",
"role": "business-owner",
"automationBeneficiary": "my-team",
"companySize": "20-99",
"reportedSource": "friend",
"version": "v4",
"personalization_survey_submitted_at": "2024-08-23T06:57:52.856Z",
"personalization_survey_n8n_version": "1.55.3"
},
"settings": {
"userActivated": true,
"firstSuccessfulWorkflowId": "s6zsznwVs6N4L2Hx",
"userActivatedAt": 1725957335278,
"npsSurvey": {
"responded": true,
"lastShownAt": 1742365155724
},
"isOnboarded": true
},
"role": "global:owner",
"disabled": false,
"mfaEnabled": false,
"isPending": false,
"isOwner": true
}
}
]
}
}
],
"tags": []
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment