Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
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
dify
Commits
23dcbacf
Commit
23dcbacf
authored
May 28, 2025
by
zhouwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
da437dd3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
263 additions
and
0 deletions
+263
-0
新闻标签与翻译-火山DeepseekV3.yml
新闻标签与翻译-火山DeepseekV3.yml
+263
-0
No files found.
新闻标签与翻译-火山DeepseekV3.yml
0 → 100644
View file @
23dcbacf
app
:
description
:
对新闻打上人为灾害事件
icon
:
✉️
icon_background
:
'
#E0F2FE'
mode
:
workflow
name
:
新闻标签与翻译-火山DeepseekV3
use_icon_as_answer_icon
:
false
dependencies
:
-
current_identifier
:
null
type
:
marketplace
value
:
marketplace_plugin_unique_identifier
:
langgenius/volcengine_maas:0.0.10@ba0a7fc3151e89bf8645cd3abb3ccff971ee59e5b1127efca50b092dbb93bf80
kind
:
app
version
:
0.1.5
workflow
:
conversation_variables
:
[]
environment_variables
:
[]
features
:
file_upload
:
allowed_file_extensions
:
-
.JPG
-
.JPEG
-
.PNG
-
.GIF
-
.WEBP
-
.SVG
allowed_file_types
:
-
image
allowed_file_upload_methods
:
-
local_file
-
remote_url
enabled
:
false
fileUploadConfig
:
audio_file_size_limit
:
50
batch_count_limit
:
5
file_size_limit
:
15
image_file_size_limit
:
10
video_file_size_limit
:
100
workflow_file_upload_limit
:
10
image
:
enabled
:
false
number_limits
:
3
transfer_methods
:
-
local_file
-
remote_url
number_limits
:
3
opening_statement
:
'
'
retriever_resource
:
enabled
:
false
sensitive_word_avoidance
:
enabled
:
false
speech_to_text
:
enabled
:
false
suggested_questions
:
[]
suggested_questions_after_answer
:
enabled
:
false
text_to_speech
:
enabled
:
false
language
:
'
'
voice
:
'
'
graph
:
edges
:
-
data
:
isInIteration
:
false
sourceType
:
code
targetType
:
end
id
:
1727242813814-source-1727235861736-target
source
:
'
1727242813814'
sourceHandle
:
source
target
:
'
1727235861736'
targetHandle
:
target
type
:
custom
zIndex
:
0
-
data
:
isInIteration
:
false
sourceType
:
start
targetType
:
llm
id
:
1727233123593-source-1732778846154-target
source
:
'
1727233123593'
sourceHandle
:
source
target
:
'
1732778846154'
targetHandle
:
target
type
:
custom
zIndex
:
0
-
data
:
isInIteration
:
false
sourceType
:
llm
targetType
:
code
id
:
1732778846154-source-1727242813814-target
source
:
'
1732778846154'
sourceHandle
:
source
target
:
'
1727242813814'
targetHandle
:
target
type
:
custom
zIndex
:
0
nodes
:
-
data
:
desc
:
"
{
\n
\"
msg_info
\"
:
\"
DeryckWhibley坚称他'不是骗子',前经理否认了性胁迫指控
\"
,
\n
\"
sys.files
\"\
:
[],
\n
\"
sys.user_id
\"
:
\"
sl_backend_twitter
\"\n
}"
selected
:
false
title
:
开始
type
:
start
variables
:
-
label
:
msg_info
max_length
:
2000
options
:
[]
required
:
true
type
:
paragraph
variable
:
msg_info
height
:
197
id
:
'
1727233123593'
position
:
x
:
-61.60583804915933
y
:
291.69166477189617
positionAbsolute
:
x
:
-61.60583804915933
y
:
291.69166477189617
selected
:
false
sourcePosition
:
right
targetPosition
:
left
type
:
custom
width
:
243
-
data
:
desc
:
'
'
outputs
:
-
value_selector
:
-
'
1727242813814'
-
result
variable
:
result
selected
:
false
title
:
结束
type
:
end
height
:
89
id
:
'
1727235861736'
position
:
x
:
1122.9814661452995
y
:
304.9033674451216
positionAbsolute
:
x
:
1122.9814661452995
y
:
304.9033674451216
selected
:
false
sourcePosition
:
right
targetPosition
:
left
type
:
custom
width
:
243
-
data
:
code
:
"
disaster_dict
=
{
\n
\"
工业事故
\"
:
\"
IndustriaAccident
\"
,
\n
\"
交通事故
\"\
:
\"
TrafficAccident
\"
,
\n
\"
火灾
\"
:
\"
Fire
\"
,
\n
\"
爆炸事件
\"
:
\"
Explosion
\"\
,
\n
\"
核事故
\"
:
\"
NuclearAccident
\"
,
\n
\"
化学品泄漏
\"
:
\"
ChemicalSpill
\"
,
\n\
\
\"
油轮泄漏
\"
:
\"
OilSpill
\"
,
\n
\"
矿难
\"
:
\"
MiningAccident
\"
,
\n
\"
矿事故
\"\
:
\"
MiningAccident
\"
,
\n
\"
食物中毒
\"
:
\"
FoodPoisoning
\"
,
\n
\"
公共卫生事件
\"\
:
\"
PublicHealthEmergency
\"
,
\n
\"
恐怖袭击
\"
:
\"
Terrorism
\"
,
\n
\"
建筑物倒塌
\"\
:
\"
BuildingCollapse
\"
,
\n
\"
建筑物坍塌
\"
:
\"
BuildingCollapse
\"
,
\n
\"
水坝溃坝
\"\
:
\"
DamBurst
\"
,
\n
\"
游行抗议
\"
:
\"
Protest
\"\n
}
\n
news_tag_dict
=
{
\n\"
枪击
\"\
:
\"
TagShooting
\"
,
\n\"
抢劫
\"
:
\"
TagRobbery
\"
,
\n\"
爆炸
\"
:
\"
TagExplosion
\"
,
\n\"\
恐怖袭击
\"
:
\"
TagTerroristAttack
\"
,
\n\"
纵火
\"
:
\"
TagArson
\"
,
\n\"
大规模伤亡事件
\"
:
\"
TagMassCasualtyIncident
\"\
,
\n\"
人质事件
\"
:
\"
TagHostageSituation
\"
,
\n\"
毒气泄漏
\"
:
\"
TagToxicGasLeak
\"
,
\n\"\
生物危害
\"
:
\"
TagBiologicalHazard
\"
,
\n\"
交通意外
\"
:
\"
TagTrafficAccident
\"
,
\n\"
建筑物倒塌
\"\
:
\"
TagBuildingCollapse
\"
,
\n\"
食品安全
\"
:
\"
TagFoodSafety
\"
,
\n\"
社会冲突
\"
:
\"
TagSocialConflict
\"\
,
\n\"
群体性事件
\"
:
\"
TagMassGatheringIncident
\"
,
\n\"
环境污染
\"
:
\"
TagEnvironmentalPollution
\"\
,
\n\"
重大事故
\"
:
\"
TagMajorAccident
\"
,
\n\"
抗议示威
\"
:
\"
TagProtestDemonstration
\"\
,
\n\"
集体维权
\"
:
\"
TagCollectiveAdvocacy
\"
,
\n\"
活动失控骚乱
\"
:
\"
TagUncontrolledEventRiot
\"\
,
\n\"
地域冲突
\"
:
\"
TagTerritorialConflict
\"
,
\n\"
性别冲突
\"
:
\"
TagGenderConflict
\"\
,
\n\"
宗教冲突
\"
:
\"
TagReligiousConflict
\"
,
\n\"
民族冲突
\"
:
\"
TagEthnicConflict
\"
,
\n\
\"
阶级冲突
\"
:
\"
TagClassConflict
\"
,
\n\"
食物中毒
\"
:
\"
TagFoodPoisoning
\"
,
\n\"
公共卫生事件
\"\
:
\"
PublicHealthEmergency
\"
,
\n\"
环境污染
\"
:
\"
TagEnvironmentalPollution
\"
,
\n\"\
活动失控骚乱
\"
:
\"
TagUncontrolledEventRiot
\"
,
\n\"
抗议示威
\"
:
\"
TagProtestDemonstration
\"\
,
\n\"
工业事故
\"
:
\"
IndustriaAccident
\"
,
\n\"
核事故
\"
:
\"
NuclearAccident
\"
,
\n\"
性别冲突
\"\
:
\"
TagGenderConflict
\"
,
\n\"
矿难
\"
:
\"
MiningAccident
\"
,
\n\"
游行抗议
\"
:
\"
Protest
\"\
,
\n\"
水坝溃坝
\"
:
\"
DamBurst
\"
,
\n\"
油轮泄漏
\"
:
\"
OilSpill
\"
,
\n\"
火灾
\"
:
\"
Fire
\"\n
}
\n\n\
def
main(kn_result:
dict)
->
dict:
\n
print(kn_result)
\n
kn_result
\
\
=
kn_result.replace(
\"
输出:
\"
,
\"\"
)
\n
kn_result
=
kn_result.replace(
\"\
```json
\"
,
\"\"
).replace(
\"
```
\"
,
\"\"
).strip()
\n
data
=
json.loads(kn_result)
\n\
\
converted_data
=
[]
\n
for
item
in
data:
\n
new_item
=
item.copy()
\
\
#
创建副本以避免修改原始数据
\n
new_item[
\"
news_tag
\"
]
=
convert_tags(item[
\"\
news_tag
\"
],
news_tag_dict)
\n
new_item[
\"
disaster
\"
]
=
convert_tags(item[
\"\
disaster
\"
],
disaster_dict)
\n
converted_data.append(new_item)
\n
\
\
return
{
\n
\"
result
\"
:
converted_data,
\n
}
\n
\n
def
convert_item(item):
\n\
\
item[
\"
disaster
\"
]
=
[disaster_dict.get(tag,
tag)
for
tag
in
item[
\"\
disaster
\"
]]
\n
item[
\"
news_tag
\"
]
=
[news_tag_dict.get(tag,
tag)
for
\
\
tag
in
item[
\"
news_tag
\"
]]
\n
return
item
\n\n
def
convert_tags(tag_list,
\
\
mapping_dict):
\n
converted
=
[]
\n
for
tag
in
tag_list:
\n
\
\
if
tag
in
mapping_dict:
\n
converted.append({
\n
\
\
\"
code
\"
:
mapping_dict[tag],
\n
\"
name
\"
:
tag
\n
\
\
})
\n
return
converted
\n\n
\n
\n
"
code_language
:
python3
desc
:
'
'
outputs
:
result
:
children
:
null
type
:
array[object]
selected
:
false
title
:
KnResult2Obj
type
:
code
variables
:
-
value_selector
:
-
'
1732778846154'
-
text
variable
:
kn_result
height
:
53
id
:
'
1727242813814'
position
:
x
:
663.6977906608877
y
:
291.69166477189617
positionAbsolute
:
x
:
663.6977906608877
y
:
291.69166477189617
selected
:
false
sourcePosition
:
right
targetPosition
:
left
type
:
custom
width
:
243
-
data
:
context
:
enabled
:
false
variable_selector
:
[]
desc
:
'
'
model
:
completion_params
:
top_p
:
0.7
mode
:
chat
name
:
deepseek-v3-250324
provider
:
langgenius/volcengine_maas/volcengine_maas
prompt_template
:
-
id
:
ff06405d-dfb9-40ca-987a-c24fd3cfd6fb
role
:
system
text
:
"
```xml
\n
<instruction>
\n
同时对多条新闻内容进行打上新闻标签分类、人为灾害标签分类以及翻译成指定语言,仅当新闻标签评分达到或超过80分时才应用新闻标签,仅当人为灾害标签评分达到或超过80分时才应用人为灾害标签,翻译必须进行,每条数据都唯一标识ID。输入为JSON数组,输出也为JSON数组。具体要求如下:
\n\
\n
1.
**输入格式**:
\n
-
输入是一个JSON数组,每个对象包含以下字段:
\n
-
`content`:新闻内容文本
\
\
\n
-
`id`:唯一标识ID
\n
-
`language`:目标翻译语言
\n\n
2.
**输出格式**:
\
\
\n
-
输出是一个JSON数组,每个对象包含以下字段:
\n
-
`content`:翻译后的新闻内容
\n
\
\
-
`id`:与输入相同的唯一标识ID
\n
-
`language`:目标翻译语言
\n
-
`news_tag`:新闻标签列表(仅当评分≥80分时应用)
\
\
\n
-
`disaster`:人为灾害标签列表(仅当评分≥80分时应用)
\n\n
3.
**标签分类规则**:
\n
\
\
-
新闻标签和人为灾害标签的评分范围为0-100分,仅当评分≥80分时才将标签添加到输出中。
\n
-
翻译必须执行,无论标签评分如何。
\
\
\n\n
4.
**标签列表**:
\n
-
人为灾害标签包括:工业事故、交通事故、火灾、爆炸事件、核事故、化学品泄漏、油轮泄漏、矿难、矿事故、食物中毒、公共卫生事件、恐怖袭击、建筑物倒塌、建筑物坍塌、水坝溃坝、游行抗议。
\
\
\n
-
新闻标签包括:枪击、抢劫、爆炸、恐怖袭击、纵火、大规模伤亡事件、人质事件、毒气泄漏、生物危害、交通意外、建筑物倒塌、食品安全、社会冲突、群体性事件、重大事故、集体维权、地域冲突、宗教冲突、民族冲突、阶级冲突、食物中毒、公共卫生事件、环境污染、活动失控骚乱、抗议示威、工业事故、核事故、性别冲突、矿难、游行抗议、水坝溃坝、油轮泄漏、火灾。
\
\
\n\n
5.
**注意事项**:
\n
-
输出中不得包含任何XML标签。
\n
-
确保每条数据的唯一标识ID与输入一致。
\
\
\n
-
如果新闻内容无法分类或评分低于80分"
-
id
:
9f485eef-bc41-4f14-b8dd-9d507b6a8d3d
role
:
user
text
:
'
{{#1727233123593.msg_info#}}'
selected
:
true
title
:
LLM
type
:
llm
variables
:
[]
vision
:
enabled
:
false
height
:
89
id
:
'
1732778846154'
position
:
x
:
241.82807864225322
y
:
291.69166477189617
positionAbsolute
:
x
:
241.82807864225322
y
:
291.69166477189617
selected
:
true
sourcePosition
:
right
targetPosition
:
left
type
:
custom
width
:
243
viewport
:
x
:
-69.13444414899118
y
:
-31.321377611778587
zoom
:
0.9916334123407837
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