-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAI资讯每日新闻+语音播报工作流.yml
More file actions
389 lines (386 loc) · 12.5 KB
/
Copy pathAI资讯每日新闻+语音播报工作流.yml
File metadata and controls
389 lines (386 loc) · 12.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
app:
description: 本工作流主要功能是用户输需要的新闻资讯数量,借助craw4ai爬取www.aibase.com每日最新AI新闻资讯,结合大语言模型+TTS语音播报形成每日AI新闻+语音播报工作流
icon: ghost
icon_background: '#FFEAD5'
mode: advanced-chat
name: AI资讯每日新闻+语音播报工作流
use_icon_as_answer_icon: false
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: true
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: start
targetType: code
id: 1736414379726-source-1737530544739-target
source: '1736414379726'
sourceHandle: source
target: '1737530544739'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: code
targetType: llm
id: 1737530544739-source-1737530620810-target
source: '1737530544739'
sourceHandle: source
target: '1737530620810'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: tool
targetType: code
id: 1738552651385-source-1738552718729-target
source: '1738552651385'
sourceHandle: source
target: '1738552718729'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: code
targetType: answer
id: 1738552718729-source-answer-target
source: '1738552718729'
sourceHandle: source
target: answer
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: template-transform
id: 1737530620810-source-1738553119261-target
source: '1737530620810'
sourceHandle: source
target: '1738553119261'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: template-transform
targetType: tool
id: 1738553119261-source-1738552651385-target
source: '1738553119261'
sourceHandle: source
target: '1738552651385'
targetHandle: target
type: custom
zIndex: 0
nodes:
- data:
desc: ''
selected: false
title: 开始
type: start
variables:
- label: 新闻数量
max_length: 48
options:
- '2'
required: true
type: select
variable: item
height: 89
id: '1736414379726'
position:
x: -27.140103876667297
y: 247.38453878161886
positionAbsolute:
x: -27.140103876667297
y: 247.38453878161886
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
answer: '{{#1738553119261.output#}}
{{#1738552718729.result#}}'
desc: ''
selected: false
title: 直接回复
type: answer
variables: []
height: 123
id: answer
position:
x: 1323.9280936455675
y: 506.70767087364436
positionAbsolute:
x: 1323.9280936455675
y: 506.70767087364436
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
code: "import requests\nimport json\ndef main(arg1: str) -> dict:\n try:\n\
\ # 构造请求URL和参数\n url = 'http://127.0.0.1:8086/news/'\n\
\ limit = arg1\n\n # 发送GET请求\n response = requests.get(url,\
\ params={'limit': limit})\n\n # 检查响应状态码\n if response.status_code\
\ == 200:\n # 请求成功,处理结果\n result = response.json()\n\
\n # 提取新闻数据和新闻详情字符串\n news_list = result.get('news',\
\ [])\n newsdetail = result.get('newsdetail', \"\")\n\n \
\ # 确保 news_list 是一个列表\n if not isinstance(news_list, list):\n\
\ return {\"error\": \"服务端返回的新闻数据格式不正确,'news' 字段应为列表。\"}\n\
\n # 格式化新闻数据(如果需要)\n formatted_news = []\n \
\ for news_item in news_list:\n if isinstance(news_item,\
\ dict): # 如果是字典,直接添加\n formatted_news.append(news_item)\n\
\ elif isinstance(news_item, str): # 如果是字符串,尝试解析为字典\n \
\ try:\n news_dict = json.loads(news_item)\
\ # 使用 json.loads 解析字符串\n formatted_news.append(news_dict)\n\
\ except Exception as e:\n print(f\"\
解析新闻数据时出错: {e}\")\n else:\n print(\"无效的新闻数据格式\"\
)\n\n # 返回格式化的新闻数据和新闻详情字符串\n return {\"news\": formatted_news,\
\ \"newsdetail\": newsdetail}\n else:\n # 请求失败,返回错误信息\n\
\ return {\"error\": f\"请求失败,状态码: {response.status_code}\"}\n\
\n except requests.exceptions.RequestException as e:\n # 捕获请求异常\n\
\ return {\"error\": f\"请求出错: {str(e)}\"}"
code_language: python3
desc: ''
outputs:
news:
children: null
type: array[object]
newsdetail:
children: null
type: string
selected: false
title: 调用服务端crawl4ai获取每日AI资讯新闻
type: code
variables:
- value_selector:
- '1736414379726'
- item
variable: arg1
height: 53
id: '1737530544739'
position:
x: 284.0152220117407
y: 247.38453878161886
positionAbsolute:
x: 284.0152220117407
y: 247.38453878161886
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params:
temperature: 0.7
mode: chat
name: internlm/internlm2_5-7b-chat
provider: siliconflow
prompt_template:
- id: 2cdb492c-3973-401d-913c-a8fee4c7fe0a
role: system
text: '请帮我对以下文章内容进行总结,包括用三个部分,摘要,文章要点
🏷文章要点用数字序号列出。
不要使用''**''加粗标题优化输出格式。'
- id: d2460303-5fe5-479b-b1c9-3d0f1c01f6dd
role: user
text: 文本内容:{{#1737530544739.news#}}
selected: true
title: 新闻总结助理
type: llm
variables: []
vision:
enabled: false
height: 97
id: '1737530620810'
position:
x: 615.0960566045045
y: 220.19946185117294
positionAbsolute:
x: 615.0960566045045
y: 220.19946185117294
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
desc: ''
provider_id: fe2f4c5a-3fc5-4265-80f6-824c803d07de
provider_name: siliconflowmakeaudioapi
provider_type: api
selected: false
title: 新闻详细内容转换语音播报
tool_configurations: {}
tool_label: generate-audio_post
tool_name: generate-audio_post
tool_parameters:
input:
type: mixed
value: '{{#1738553119261.output#}}'
model:
type: mixed
value: FunAudioLLM/CosyVoice2-0.5B
voice:
type: mixed
value: FunAudioLLM/CosyVoice2-0.5B:david
type: tool
height: 53
id: '1738552651385'
position:
x: 1430.6589861398134
y: 187.15743068817272
positionAbsolute:
x: 1430.6589861398134
y: 187.15743068817272
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
code: "def main(arg1: str) -> str:\n # 首先解析外层的 JSON 字符串\n data = json.loads(arg1)\n\
\ filename=data['filename']\n url=data['etag']\n markdown_result\
\ = f\"<audio controls><source src='{url}' type='audio/mpeg'>{filename}</audio>\"\
\n return {\"result\": markdown_result} "
code_language: python3
desc: ''
outputs:
result:
children: null
type: string
selected: false
title: 文字转音频文件处理
type: code
variables:
- value_selector:
- '1738552651385'
- text
variable: arg1
height: 53
id: '1738552718729'
position:
x: 764.2473856361112
y: 540.7478368173164
positionAbsolute:
x: 764.2473856361112
y: 540.7478368173164
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
desc: ''
selected: false
template: '{{ llmtext+"\n"+"下面新闻详细内容:"+"\n"+newsdetail }}'
title: llm新闻总结信息+新闻详细信息合并
type: template-transform
variables:
- value_selector:
- '1737530620810'
- text
variable: llmtext
- value_selector:
- '1737530544739'
- newsdetail
variable: newsdetail
height: 53
id: '1738553119261'
position:
x: 947.9912276567427
y: 220.19946185117294
positionAbsolute:
x: 947.9912276567427
y: 220.19946185117294
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
author: 周辉
desc: ''
height: 245
selected: false
showAuthor: true
text: '{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"本工作流主要使用了LLM大语言模型+crawl4ai获取每日最新的新闻资讯,通过语音播报功能实现一个每日AI资讯新闻获取+语音播报的功能。","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"
考虑生成语音的时效性新闻条码目前做成下拉选项选择2条新闻播报。2条新闻播报的时间大概在 5分钟左右。","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}'
theme: blue
title: ''
type: ''
width: 488
height: 245
id: '1738553820665'
position:
x: -52.46682494203276
y: 358.6119717633246
positionAbsolute:
x: -52.46682494203276
y: 358.6119717633246
selected: false
sourcePosition: right
targetPosition: left
type: custom-note
width: 488
viewport:
x: 41.25284483232349
y: 41.07067420123835
zoom: 0.7169776240079166