-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexcel表格提取+echarts展示.yml
More file actions
290 lines (290 loc) · 10.2 KB
/
Copy pathexcel表格提取+echarts展示.yml
File metadata and controls
290 lines (290 loc) · 10.2 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
app:
description: 本工作流主要是使用excel表格提取(文件提取)以及通过echarts展示近5日上证指数
icon: 🤖
icon_background: '#FFEAD5'
mode: advanced-chat
name: excel表格提取+echarts展示
use_icon_as_answer_icon: true
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: document-extractor
id: 1740472103530-source-1740472111460-target
source: '1740472103530'
sourceHandle: source
target: '1740472111460'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: document-extractor
targetType: llm
id: 1740472111460-source-1740473717276-target
source: '1740472111460'
sourceHandle: source
target: '1740473717276'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: code
id: 1740473717276-source-1740476771273-target
source: '1740473717276'
sourceHandle: source
target: '1740476771273'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: code
targetType: answer
id: 1740476771273-source-answer-target
source: '1740476771273'
sourceHandle: source
target: answer
targetHandle: target
type: custom
zIndex: 0
nodes:
- data:
desc: ''
selected: false
title: 开始
type: start
variables:
- allowed_file_extensions: []
allowed_file_types:
- document
allowed_file_upload_methods:
- local_file
- remote_url
label: 文件名
max_length: 48
options: []
required: true
type: file
variable: file
height: 88
id: '1740472103530'
position:
x: -260.96512808648583
y: 246.99716857805686
positionAbsolute:
x: -260.96512808648583
y: 246.99716857805686
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
answer: '{{#1740476771273.result#}}'
desc: ''
selected: true
title: 直接回复
type: answer
variables: []
height: 101
id: answer
position:
x: 1017
y: 252
positionAbsolute:
x: 1017
y: 252
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
desc: ''
is_array_file: false
selected: false
title: 文档提取器
type: document-extractor
variable_selector:
- '1740472103530'
- file
height: 90
id: '1740472111460'
position:
x: 82
y: 257
positionAbsolute:
x: 82
y: 257
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params:
temperature: 0.7
mode: chat
name: deepseek-ai/DeepSeek-V2.5
provider: siliconflow
prompt_template:
- edition_type: basic
id: 2a959ee9-744e-4f76-a1d8-be5594785d6e
role: system
text: "你是一个文档提取专家,请根据用户上传文档内容{{#1740472111460.text#}}提取该表格里面的数据返回json格式数据。\n\
其中内容格式‘上证指数日线行情’、‘open’、‘high’、‘low’、‘close’、‘volume’字段返回信息,返回的结果信息以json格式返回\n\
\ 返回数据格式如下:\n{\n\"上证指数日线行情\": [\n{\n\"date\": \"2025-02-19 00:00:00\"\
,\n\"open\": 3320.78,\n\"high\": 3352.09,\n\"low\": 3320.58,\n\"close\"\
: 3351.54,\n\"volume\": 50291300000\n},\n{\n\"date\": \"2025-02-20 00:00:00\"\
,\n\"open\": 3347.59,\n\"high\": 3355.56,\n\"low\": 3338.03,\n\"close\"\
: 3350.78,\n\"volume\": 50435700000\n}\n]\n}\n"
selected: false
title: LLM
type: llm
variables: []
vision:
enabled: false
height: 96
id: '1740473717276'
position:
x: 384
y: 257
positionAbsolute:
x: 384
y: 257
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
code: "import json\nimport os\nimport re\n\ndef main(json_str: str) -> dict:\n\
\ try:\n # 预处理:清理非 JSON 部分\n json_match = re.search(r'\\\
{.*\\}', json_str, re.DOTALL)\n if not json_match:\n return\
\ {\"result\": \"Error: Invalid JSON format\"}\n \n # 提取合法的\
\ JSON 部分\n cleaned_json_str = json_match.group(0)\n \n \
\ # 解析JSON数据\n data = json.loads(cleaned_json_str)\n \
\ filename = data.get(\"filename\", \"stock_chart.html\")\n stock_data\
\ = data.get(\"上证指数日线行情\", [])\n \n # 准备数据格式\n dates\
\ = [item['date'].split(' ')[0] for item in stock_data] # 提取日期部分(去掉时间)\n\
\ open_prices = [item['open'] for item in stock_data]\n close_prices\
\ = [item['close'] for item in stock_data]\n low_prices = [item['low']\
\ for item in stock_data]\n high_prices = [item['high'] for item\
\ in stock_data]\n volumes = [item['volume'] / 1e8 for item in stock_data]\
\ # 转换为亿单位\n \n # 构建ECharts配置\n echarts_config = {\n\
\ \"title\": {\n \"text\": \"上证指数日线行情\"\n \
\ },\n \"legend\": {\n \"data\": [\"开盘价\"\
, \"最高价\", \"最低价\", \"收盘价\", \"成交量\"]\n },\n \"tooltip\"\
: {},\n \"dataset\": {\n \"source\": [\n \
\ [\"日期\", \"开盘价\", \"最高价\", \"最低价\", \"收盘价\", \"成交量\"],\n\
\ *[[dates[i], open_prices[i], high_prices[i], low_prices[i],\
\ close_prices[i], volumes[i]] \n for i in range(len(dates))]\n\
\ ]\n },\n \"xAxis\": [\n \
\ {\"type\": \"category\", \"gridIndex\": 0},\n {\"\
type\": \"category\", \"gridIndex\": 1}\n ],\n \"\
yAxis\": [\n {\n \"gridIndex\": 0,\n \
\ \"name\": \"价格趋势(单位:点)\"\n },\n \
\ {\n \"gridIndex\": 1,\n \
\ \"name\": \"成交量(单位:亿)\"\n }\n ],\n \
\ \"grid\": [\n {\"bottom\": \"55%\"},\n \
\ {\"top\": \"55%\"}\n ],\n \"series\": [\n \
\ # 第一个网格中的折线图系列\n {\"type\": \"line\", \"seriesLayoutBy\"\
: \"row\", \"name\": \"开盘价\"},\n {\"type\": \"line\", \"\
seriesLayoutBy\": \"row\", \"name\": \"最高价\"},\n {\"type\"\
: \"line\", \"seriesLayoutBy\": \"row\", \"name\": \"最低价\"},\n \
\ {\"type\": \"line\", \"seriesLayoutBy\": \"row\", \"name\": \"收盘价\"\
},\n # 第二个网格中的柱状图系列\n {\"type\": \"bar\",\
\ \"xAxisIndex\": 1, \"yAxisIndex\": 1, \"name\": \"成交量\"}\n \
\ ]\n }\n \n # 生成输出文件\n output = \"```echarts\\\
n\" + json.dumps(echarts_config, indent=2, ensure_ascii=False) + \"\\n```\"\
\n \n # 返回结果\n return {\n \"result\": output\n\
\ }\n \n except Exception as e:\n return {\n \
\ \"result\": f\"Error: {str(e)}\"\n }"
code_language: python3
desc: ''
outputs:
result:
children: null
type: string
selected: false
title: erchart代码转换生成
type: code
variables:
- value_selector:
- '1740473717276'
- text
variable: json_str
height: 52
id: '1740476771273'
position:
x: 693.5717319380653
y: 257
positionAbsolute:
x: 693.5717319380653
y: 257
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
viewport:
x: -10.400499055005412
y: -15.625242345168317
zoom: 1.1665290443361072