Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
n8n
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhouwei
n8n
Commits
f8cf9dbd
Commit
f8cf9dbd
authored
Apr 09, 2025
by
马超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
e513e6e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
277 additions
and
0 deletions
+277
-0
tw_search_do_label.json
20250409/tw_search_do_label.json
+277
-0
No files found.
20250409/tw_search_do_label.json
0 → 100644
View file @
f8cf9dbd
{
"createdAt"
:
"2025-04-07T09:07:55.439Z"
,
"updatedAt"
:
"2025-04-09T06:41:33.000Z"
,
"id"
:
"OkLNJG1HWObUFcS0"
,
"name"
:
"tw_search_do_label"
,
"active"
:
true
,
"nodes"
:
[
{
"parameters"
:
{
"operation"
:
"executeQuery"
,
"query"
:
"CALL do_label_news_source({{ JSON.stringify(JSON.stringify($json.news_id))}},{{ JSON.stringify(JSON.stringify($json.label_data)) }},{{ JSON.stringify(JSON.stringify($json.artificial_label_data)) }});"
,
"options"
:
{}
},
"id"
:
"3fd1cd68-88f3-4d6f-91e8-a08b6acf2c10"
,
"name"
:
"insert_city_news"
,
"type"
:
"n8n-nodes-base.mySql"
,
"typeVersion"
:
2.4
,
"position"
:
[
740
,
480
],
"credentials"
:
{
"mySql"
:
{
"id"
:
"09oRI0DULmEzD9l8"
,
"name"
:
"SL-DB"
}
}
},
{
"parameters"
:
{
"jsCode"
:
"// Loop over input items and add a new field called 'myNewField' to the JSON of each one
\n
result_data = $input.all();
\n
content_all = {};
\n
for(let item_index =0; item_index < result_data.length;item_index++){
\n
item_data = result_data[item_index].json;
\n
if('label_data' in item_data){
\n
content_all['label'] = item_data['label_data'];
\n
}else if('artificial_label_data' in item_data){
\n
content_all['artificial_label'] = item_data['artificial_label_data'];
\n
}
\n
};
\n
// console.log(content_all);
\n
info_data_list = JSON.parse($('Webhook').all()[0].json.body.info);
\n
schedule_id = $('Webhook').all()[0].json.body.schedule_id;
\n
label_data_list = content_all.label;
\n
artificial_label_data_list = content_all.artificial_label;
\n
if(artificial_label_data_list.length>0){
\n
artificial_label_data_list[0]['city_code'] = info_data_list.city_code;
\n
}
\n
function isEmptyString(value) {
\n
// 方法1: 直接检查是否为空字符串或null
\n
if (!value || value.trim() == '' || value.trim() == 'null' || value.trim() == 'None') {
\n
return true;
\n
}
\n
return false;
\n
};
\n
output_all = [];
\n
output_all_data_temp = {};
\n
output_all_data_temp['news_id'] = info_data_list.id;
\n
output_all_data_temp['label_data'] = label_data_list;
\n
output_all_data_temp['artificial_label_data'] = artificial_label_data_list;
\n
output_all.push(output_all_data_temp);
\n
console.log(JSON.stringify(JSON.stringify(info_data_list.id)));
\n
console.log(JSON.stringify(JSON.stringify(label_data_list)));
\n
console.log(JSON.stringify(JSON.stringify(artificial_label_data_list)));
\n
return output_all;"
},
"id"
:
"6436c8a9-c437-47cf-9788-b0a3cee9a010"
,
"name"
:
"get_city_news_sql"
,
"type"
:
"n8n-nodes-base.code"
,
"typeVersion"
:
2
,
"position"
:
[
500
,
480
]
},
{
"parameters"
:
{
"jsCode"
:
"// Loop over input items and add a new field called 'myNewField' to the JSON of each one\n//answer = \"```json{\\\"test1\\\"
:
\\\
"test
\\\"
}```
\"
;
\n
function isEmptyString(value) {
\n
// 方法1: 直接检查是否为空字符串或null
\n
if (!value || value.trim() === '') {
\n
return true;
\n
}
\n
return false;
\n
};
\n
function isEmpty(value) {
\n
// 方法1: 直接检查是否为空字符串或null
\n
if (!value) {
\n
return true;
\n
}
\n
return false;
\n
};
\n
label_data_list = [];
\n
artificial_label_data_list = [];
\n
label_data_arr = $input.all();
\n
label_result_list = [];
\n
artificial_label_result_list = [];
\n
for(var label_index=0;label_index<label_data_arr.length;label_index++){
\n
label_data_temp = label_data_arr[label_index];
\n
workflow_id = label_data_temp.json.data.workflow_id;
\n
label_data_output_list = label_data_temp.json.data.outputs;
\n
if(workflow_id == '944449cb-15ad-4648-b3b0-3f103f574e09'){
\n
if(!isEmpty(label_data_output_list)){
\n
label_result = label_data_output_list.result;
\n
for (let i = 0; i < label_result.length; i++) {
\n
label_result_list.push(label_result[i]);
\n
}
\n
}
\n
}else{
\n
if(!isEmpty(label_data_output_list)){
\n
label_result = label_data_output_list.result;
\n
let label_index_temp = 0;
\n
for (let i = 0; i < label_result.length&&label_index_temp<1; i++) {
\n
artificial_label_result_list.push(label_result[i]);
\n
label_index_temp += 1;
\n
}
\n
}
\n
}
\n
};
\n
// console.log(label_result_list);
\n
for (let i = 0; i < label_result_list.length; i++) {
\n
label_code_score = {};
\n
label_code = label_result_list[i].code;
\n
// label_score = label_result_list[i].score;
\n
label_score =
\"\"
;
\n
if(!isEmptyString(label_code)){
\n
label_code_score['code'] = label_code;
\n
label_code_score['score'] = label_score;
\n
label_data_list.push(label_code_score);
\n
}
\n
};
\n
for (let i = 0; i < artificial_label_result_list.length; i++) {
\n
label_code_score = {};
\n
label_code = artificial_label_result_list[i].code;
\n
label_name = artificial_label_result_list[i].name;
\n
// label_score = artificial_label_result_list[i].score;
\n
label_score =
\"\"
;
\n
if(!isEmptyString(label_code)){
\n
label_code_score['code'] = label_code;
\n
label_code_score['name'] = label_name;
\n
label_code_score['score'] = label_score;
\n
artificial_label_data_list.push(label_code_score);
\n
}
\n
};
\n
label_data_list_2 = [];
\n
label_data_json = {};
\n
artificial_label_data_json = {};
\n
label_data_json[
\"
label_data
\"
] = label_data_list;
\n
artificial_label_data_json[
\"
artificial_label_data
\"
] = artificial_label_data_list;
\n
// console.log(label_data_json);
\n
label_data_list_2.push(label_data_json);
\n
label_data_list_2.push(artificial_label_data_json);
\n
return label_data_list_2;"
},
"id"
:
"7e8a796a-87be-4f77-8229-793308c14cf4"
,
"name"
:
"get_label_answer"
,
"type"
:
"n8n-nodes-base.code"
,
"typeVersion"
:
2
,
"position"
:
[
240
,
480
]
},
{
"parameters"
:
{
"method"
:
"POST"
,
"url"
:
"http://172.31.0.160/v1/workflows/run"
,
"sendHeaders"
:
true
,
"specifyHeaders"
:
"json"
,
"jsonHeaders"
:
"{\n \"Authorization\"
:
\
"Bearer app-KNq0O8kENP4ITqSmqHQ0IzAt\",\n \"Content-Type\"
:
\
"application/json
\"\n
}"
,
"sendBody"
:
true
,
"specifyBody"
:
"json"
,
"jsonBody"
:
"={\n \"inputs\"
:
{
\
"msg_info\"
:
\
"{{JSON.stringify(JSON.parse($json.body.info).full_text).replaceAll(/\"/g, '\\\\\"')}}\"},\n \"response_mode\"
:
\
"blocking\",\n \"user\"
:
\
"sl_backend_twitter
\"\n
}"
,
"options"
:
{}
},
"id"
:
"ffc27f68-095e-412e-9262-a5cbca9257a5"
,
"name"
:
"news_label_dify"
,
"type"
:
"n8n-nodes-base.httpRequest"
,
"typeVersion"
:
4.2
,
"position"
:
[
-480
,
740
]
},
{
"parameters"
:
{
"method"
:
"POST"
,
"url"
:
"http://172.31.0.160/v1/workflows/run"
,
"sendHeaders"
:
true
,
"specifyHeaders"
:
"json"
,
"jsonHeaders"
:
"{\n \"Authorization\"
:
\
"Bearer app-HCbsiZmUCzP8Vdqb2meKXQSb\",\n \"Content-Type\"
:
\
"application/json
\"\n
}"
,
"sendBody"
:
true
,
"specifyBody"
:
"json"
,
"jsonBody"
:
"={\n \"inputs\"
:
{
\
"msg_info\"
:
\
"{{JSON.stringify(JSON.parse($json.body.info).full_text).replaceAll(/\"/g, '\\\\\"')}}\"},\n \"response_mode\"
:
\
"blocking\",\n \"user\"
:
\
"sl_backend_twitter
\"\n
}"
,
"options"
:
{}
},
"id"
:
"f9bce107-2aaf-486d-85dd-c99756e07f2c"
,
"name"
:
"artifi_nature_label_dify"
,
"type"
:
"n8n-nodes-base.httpRequest"
,
"typeVersion"
:
4.2
,
"position"
:
[
-480
,
260
]
},
{
"parameters"
:
{},
"id"
:
"008410d0-9f2a-4848-b2d3-411b774f4cca"
,
"name"
:
"merge_label"
,
"type"
:
"n8n-nodes-base.merge"
,
"typeVersion"
:
3
,
"position"
:
[
0
,
480
]
},
{
"parameters"
:
{
"httpMethod"
:
"POST"
,
"path"
:
"twitter/search/label"
,
"authentication"
:
"headerAuth"
,
"options"
:
{
"allowedOrigins"
:
"*"
,
"rawBody"
:
false
}
},
"id"
:
"f11677ff-bb2f-4c0a-b97b-774a0f70121e"
,
"name"
:
"Webhook"
,
"type"
:
"n8n-nodes-base.webhook"
,
"typeVersion"
:
2
,
"position"
:
[
-940
,
520
],
"webhookId"
:
"e495a29c-8f43-4175-bdb8-277e03b60b07"
,
"credentials"
:
{
"httpHeaderAuth"
:
{
"id"
:
"U87Wvnvu9oQ5Zapo"
,
"name"
:
"Header Auth account"
}
}
}
]
,
"connections"
:
{
"get_city_news_sql"
:
{
"main"
:
[
[
{
"node"
:
"insert_city_news"
,
"type"
:
"main"
,
"index"
:
0
}
]
]
},
"news_label_dify"
:
{
"main"
:
[
[
{
"node"
:
"merge_label"
,
"type"
:
"main"
,
"index"
:
1
}
]
]
},
"artifi_nature_label_dify"
:
{
"main"
:
[
[
{
"node"
:
"merge_label"
,
"type"
:
"main"
,
"index"
:
0
}
]
]
},
"get_label_answer"
:
{
"main"
:
[
[
{
"node"
:
"get_city_news_sql"
,
"type"
:
"main"
,
"index"
:
0
}
]
]
},
"merge_label"
:
{
"main"
:
[
[
{
"node"
:
"get_label_answer"
,
"type"
:
"main"
,
"index"
:
0
}
]
]
},
"Webhook"
:
{
"main"
:
[
[
{
"node"
:
"artifi_nature_label_dify"
,
"type"
:
"main"
,
"index"
:
0
},
{
"node"
:
"news_label_dify"
,
"type"
:
"main"
,
"index"
:
0
}
]
]
}
},
"settings"
:
{
"executionOrder"
:
"v1"
},
"staticData"
:
null
,
"meta"
:
{
"templateCredsSetupCompleted"
:
true
},
"pinData"
:
{},
"versionId"
:
"e5fc9923-c4dd-4b56-8648-dd07b26e068c"
,
"triggerCount"
:
1
,
"shared"
:
[
{
"createdAt"
:
"2025-04-07T09:07:55.459Z"
,
"updatedAt"
:
"2025-04-07T09:07:55.459Z"
,
"role"
:
"workflow:owner"
,
"workflowId"
:
"OkLNJG1HWObUFcS0"
,
"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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment