Repository navigation
Expand file tree
/
Copy pathopenapi.yaml
More file actions
2025 lines (1927 loc) · 76.4 KB
/
Copy pathopenapi.yaml
File metadata and controls
2025 lines (1927 loc) · 76.4 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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: "3.1.0"
info:
title: ElectroChem — Intelligent Electrochemical Data Processing Software
description: |
智能电化学数据处理软件的本地 HTTP API。
服务默认运行在 `http://127.0.0.1:8010`。
JSON 响应使用 UTF-8 编码;业务响应通常使用 `status: "success" | "error"`。
根信息使用 `"running"`,健康检查使用 `"ok"`;任务对象另有生命周期状态。
version: "7.0.1"
license:
name: MIT
url: https://github.com/Sunnnnch/electro_data_process_tool/blob/main/LICENSE
servers:
- url: http://127.0.0.1:8010
description: 本地开发/桌面默认端口
tags:
- name: Health
description: 服务健康检查
- name: Projects
description: 项目的 CRUD 与指标查询
- name: History
description: 处理历史记录管理
- name: Processing
description: 批量数据处理(文件夹/ZIP)
- name: LLM
description: LLM 配置与 AI 会话
- name: Agent
description: AI Agent 会话管理
- name: Templates
description: 处理参数模板
- name: Quality
description: 数据质量报告
- name: System
description: 系统级操作(文件夹选择、路径打开)
- name: Storage
description: 应用托管运行文件统计与安全清理
- name: Tasks
description: 处理与分析助手任务的统一进度、状态和取消入口
- name: Replicates
description: 独立重复实验选择、来源核对、统计和导出
paths:
/:
get:
operationId: getRoot
tags: [Health]
summary: API 根信息
responses:
"200":
description: 服务名称、状态与可用端点
content:
application/json:
schema:
$ref: "#/components/schemas/RootInfo"
/health:
get:
operationId: getHealth
tags: [Health]
summary: 健康检查
responses:
"200":
description: 服务在线
content:
application/json:
schema:
type: object
properties:
status: { type: string, example: ok }
# ── Projects ──────────────────────────────────────────────────────────
/api/v1/projects:
get:
operationId: listProjects
tags: [Projects]
summary: 列出所有项目
parameters:
- name: status
in: query
schema: { type: string, enum: [active, archived, all], default: active }
responses:
"200":
description: 项目列表;每个项目返回 default_template_name,旧项目或未关联时为空字符串。模板删除后保留其名称。
content:
application/json:
schema:
type: object
properties:
status: { type: string, const: success }
projects:
type: array
items: { $ref: "#/components/schemas/Project" }
post:
operationId: createProject
tags: [Projects]
summary: 创建项目
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name]
properties:
name: { type: string, example: "HER-Pt-2026" }
description: { type: string }
tags: { type: array, items: { type: string } }
color: { type: string, pattern: "^#[0-9a-fA-F]{6}$" }
default_template_name:
type: string
default: ""
description: 关联现有内置或用户参数模板的名称。空字符串表示不关联;名称两端空白会移除。仅保存关联,不自动应用处理参数。
example: "LSV_常用模板"
responses:
"200":
description: 创建成功,返回 project_id 和完整项目对象(含 default_template_name)。非字符串或不存在的模板名称返回 400。
content:
application/json:
schema:
$ref: "#/components/schemas/ProjectMutationResponse"
"400":
$ref: "#/components/responses/BadRequest"
/api/v1/projects/{project_id}/update:
post:
operationId: updateProject
tags: [Projects]
summary: 更新项目信息
parameters:
- $ref: "#/components/parameters/ProjectId"
requestBody:
content:
application/json:
schema:
type: object
properties:
name: { type: string }
description: { type: string }
tags: { type: array, items: { type: string } }
color: { type: string }
status: { type: string }
default_template_name:
type: string
description: 未提供时保留现有关联,空字符串解除关联。新的非空名称必须存在;原有模板已删除时,仍可原样保留该名称并编辑其他项目信息。null 或其他非字符串值返回 400。
responses:
"200":
description: 更新成功,返回 project_id 和完整项目对象(含 default_template_name)。参数校验失败时不保存其他字段。
content:
application/json:
schema:
$ref: "#/components/schemas/ProjectMutationResponse"
"400":
$ref: "#/components/responses/BadRequest"
/api/v1/projects/{project_id}/delete:
post:
operationId: deleteProject
tags: [Projects]
summary: 将项目移入回收站
parameters:
- $ref: "#/components/parameters/ProjectId"
responses:
"200":
description: 删除成功
"404":
$ref: "#/components/responses/NotFound"
/api/v1/projects/{project_id}/restore:
post:
operationId: restoreProject
tags: [Projects]
summary: 从项目回收站恢复
parameters:
- $ref: "#/components/parameters/ProjectId"
responses:
"200": { description: 恢复成功 }
"409": { description: 项目不在回收站或状态冲突 }
/api/v1/projects/{project_id}/delete-permanent:
post:
operationId: permanentlyDeleteProject
tags: [Projects]
summary: 永久删除回收站项目、历史和无引用托管文件
parameters:
- $ref: "#/components/parameters/ProjectId"
requestBody:
content:
application/json:
schema:
type: object
properties:
delete_artifacts: { type: boolean, default: true }
responses:
"200": { description: 永久删除成功 }
"409": { description: 必须先将项目移入回收站 }
/api/v1/projects/{project_id}/report:
post:
operationId: exportScopedProjectReport
tags: [Projects]
summary: 按明确范围导出可复现项目报告
description: 不受页面分页限制。省略选择导出全项目;run_ids 与 record_keys 不得混用,空选择无效。返回 path、markdown_path、html_path 和实际 scope。
parameters:
- $ref: "#/components/parameters/ProjectId"
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
run_ids: { type: array, minItems: 1, items: { type: string } }
record_keys: { type: array, minItems: 1, items: { type: string } }
include_archived: { type: boolean, default: false }
format: { type: string, enum: [html, markdown], default: html }
responses:
"200": { description: 完整导出所选范围并返回实际数量 }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
get:
operationId: exportProjectReport
tags: [Projects]
summary: 导出项目报告
parameters:
- $ref: "#/components/parameters/ProjectId"
- name: include_archived
in: query
schema: { type: boolean, default: false }
responses:
"200":
description: 报告导出成功
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
/api/v1/projects/{project_id}/export-zip:
get:
operationId: exportProjectZip
tags: [Projects]
summary: 打包项目输出文件为 ZIP 下载
parameters:
- $ref: "#/components/parameters/ProjectId"
- name: include_archived
in: query
schema: { type: boolean, default: false }
responses:
"200":
description: 包含全部匹配历史记录、归档清单和受信任文件的 ZIP 文件流
content:
application/zip:
schema:
type: string
format: binary
"413":
description: 项目文件数或未压缩体积超过服务端归档限制
/api/v1/projects/{project_id}/lsv-summary:
get:
operationId: getProjectLsvSummary
tags: [Projects]
summary: 项目 LSV 指标摘要
parameters:
- $ref: "#/components/parameters/ProjectId"
- name: include_archived
in: query
schema: { type: boolean, default: false }
- name: page
in: query
schema: { type: integer, default: 1 }
- name: page_size
in: query
schema: { type: integer, default: 50 }
responses:
"200":
description: LSV 指标汇总
/api/v1/projects/{project_id}/lsv-target-currents:
get:
operationId: getProjectLsvTargetCurrents
tags: [Projects]
summary: 获取已处理的目标电流密度列表
parameters:
- $ref: "#/components/parameters/ProjectId"
- name: include_archived
in: query
schema: { type: boolean, default: false }
responses:
"200":
description: 目标电流列表
/api/v1/projects/{project_id}/lsv-compare:
get:
operationId: getLsvCompare
tags: [Projects]
summary: 生成 LSV 对比图
parameters:
- $ref: "#/components/parameters/ProjectId"
- name: samples
in: query
required: true
schema: { type: string }
description: 逗号分隔的样品名
- name: chart_type
in: query
schema: { type: string, enum: [overlay, bar, scatter, radar] }
- name: metric
in: query
schema: { type: string, enum: [eta, potential, tafel] }
- name: target_current
in: query
schema: { type: number }
responses:
"200":
description: 对比图生成成功
/api/v1/projects/{project_id}/lsv-compare/latest:
get:
operationId: getLatestLsvCompare
tags: [Projects]
summary: 获取最近一次 LSV 对比图
parameters:
- $ref: "#/components/parameters/ProjectId"
responses:
"200":
description: 最新对比图
"404":
$ref: "#/components/responses/NotFound"
# ── History ───────────────────────────────────────────────────────────
/api/v1/history:
get:
operationId: listHistory
tags: [History]
summary: 列出处理历史
description: 筛选在服务端作用于全部项目历史,再按游标分页;total 为筛选后的记录总数。更换筛选条件后应清空 cursor。
parameters:
- name: project
in: query
schema: { type: string }
- name: limit
in: query
schema: { type: integer, minimum: 1, maximum: 100, default: 50 }
- name: cursor
in: query
description: 上一页响应中的 next_cursor
schema: { type: string }
- name: include_archived
in: query
schema: { type: boolean, default: false }
- name: type
in: query
schema: { type: string, enum: [LSV, CV, EIS, ECSA, COUPLED] }
- name: q
in: query
description: 按样品名或文件名做字面子串搜索,不搜索目录路径;去除两端空白,空字符串不筛选。百分号和下划线视为普通字符。
schema: { type: string }
- name: date_from
in: query
description: 包含此日期及以后的记录,按历史保存的本地日历日期比较,不进行 UTC 换算。
schema: { type: string, format: date, example: "2026-09-01" }
- name: date_to
in: query
description: 包含此日期当天的全部记录。必须为有效 YYYY-MM-DD 日期,且不得早于 date_from。
schema: { type: string, format: date, example: "2026-09-07" }
responses:
"200":
description: 不含大型 data 字段的历史摘要页,返回 next_cursor、has_more 和 total
"400":
description: 日期格式无效、开始日期晚于结束日期或游标无效;返回 status=error、message 和空 records。
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/api/v1/history/{record_key}:
get:
operationId: getHistoryDetail
tags: [History]
summary: 按精确 record_key 获取完整历史详情
parameters:
- name: record_key
in: path
required: true
schema: { type: string }
responses:
"200": { description: 完整历史记录(包含 data) }
"404": { $ref: "#/components/responses/NotFound" }
/api/v1/stats:
get:
operationId: getHistoryStats
tags: [History]
summary: 统计摘要
parameters:
- name: project_id
in: query
schema: { type: string }
- name: include_archived
in: query
schema: { type: boolean, default: false }
responses:
"200":
description: 统计数据
/api/v1/history/archive:
post:
operationId: archiveHistory
tags: [History]
summary: 归档历史记录
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [history_key]
properties:
history_key:
type: string
description: 历史列表返回的 record_key;旧格式键仅在唯一匹配时接受
responses:
"200":
description: 归档成功
"400":
$ref: "#/components/responses/BadRequest"
/api/v1/history/delete:
post:
operationId: deleteHistory
tags: [History]
summary: 删除历史记录
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [history_key]
properties:
history_key:
type: string
description: 历史列表返回的 record_key;旧格式键仅在唯一匹配时接受
delete_artifacts:
type: boolean
default: true
description: 清理不再被其他记录引用的应用托管输出;从不删除外部路径
responses:
"200":
description: 删除成功
"400":
$ref: "#/components/responses/BadRequest"
/api/v1/history/compare:
post:
operationId: compareHistoricalRecords
tags: [History]
summary: 对比明确选中的两条同项目同类型历史记录
description: 不按样品名替换成最新记录。差值为右侧减左侧;缺值、单位不一致不计算差值。包含参数、输入指纹、计算版本和质量变化。
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [left_record_key, right_record_key]
properties:
left_record_key: { type: string }
right_record_key: { type: string }
project_id: { type: string }
responses:
"200": { description: comparison 对象包含 metrics、parameter_changes、sources、versions、quality、warnings }
"400": { $ref: "#/components/responses/BadRequest" }
/api/v1/runs:
get:
operationId: listProcessingRuns
tags: [Processing]
summary: 分页读取持久运行摘要,包括没有历史记录的运行
parameters:
- { name: project_id, in: query, schema: { type: string } }
- { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 500, default: 100 } }
- { name: offset, in: query, schema: { type: integer, minimum: 0, default: 0 } }
responses:
"200": { description: runs、total、has_more、next_offset }
/api/v1/runs/{run_id}:
get:
operationId: getProcessingRun
tags: [Processing]
summary: 获取持久运行配方
parameters:
- $ref: "#/components/parameters/RunId"
responses:
"200": { description: run 对象含参数、全部输入和辅助依赖指纹、记录映射、原运行关系、软件与公式及依赖版本 }
"404": { description: 运行不存在或旧历史未保存完整配方 }
/api/v1/runs/{run_id}/replay-plan:
post:
operationId: previewRunReplay
tags: [Processing]
summary: 校验历史输入并预览复算差异
description: 可从原 ZIP 自动恢复缺失的上传输入;不会运行计算。plan 包含 source_checks、parameter_changes、can_replay、requires_changed_confirmation、issues、warnings。
parameters:
- $ref: "#/components/parameters/RunId"
requestBody:
$ref: "#/components/requestBodies/ReplayOptions"
responses:
"200": { description: 预览成功;是否可提交由 plan.can_replay 判断 }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
/api/v1/runs/{run_id}/replay:
post:
operationId: submitRunReplay
tags: [Processing]
summary: 重新校验后提交历史复算任务
description: 始终生成新 run_id 和输出目录,保留 parent_run_id/parent_record_key;排队后计算前再次校验完整输入指纹。
parameters:
- $ref: "#/components/parameters/RunId"
requestBody:
$ref: "#/components/requestBodies/ReplayOptions"
responses:
"202": { description: 已排队,返回 job 和 job_id;通过现有 process/jobs 接口查询 }
"409": { description: 预检阻断,返回 message 和 plan,不创建任务 }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
"503": { description: 任务服务不可用 }
/api/v1/runs/{run_id}/report:
post:
operationId: exportRunReport
tags: [Processing]
summary: 导出单次完整运行报告
parameters:
- $ref: "#/components/parameters/RunId"
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
format: { type: string, enum: [html, markdown], default: html }
responses:
"200": { description: path、markdown_path、html_path 和 scope;正文与可追溯附录 }
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
# ── Processing ────────────────────────────────────────────────────────
/api/v1/process/modules:
get:
operationId: listProcessingModules
tags: [Processing]
summary: 查询可用处理模块
parameters:
- name: data_types
in: query
description: 可选的逗号分隔处理方式;省略时返回全部模块
schema: { type: string, example: "LSV,CV,EIS" }
responses:
"200":
description: 运行时模块目录
content:
application/json:
schema: { type: object }
"400":
$ref: "#/components/responses/BadRequest"
/api/v1/process/schema:
get:
operationId: getProcessingParameterSchema
tags: [Processing]
summary: 查询处理参数 Schema
description: |
返回参数类型、默认值、界面默认值、范围、选项、分组和预设。
该响应是处理参数校验与界面初始化的权威来源。
parameters:
- name: data_types
in: query
description: 可选的逗号分隔处理方式;省略时返回全部内置模块参数
schema: { type: string, example: "LSV,EIS" }
responses:
"200":
description: 处理参数 Schema
content:
application/json:
schema:
$ref: "#/components/schemas/ProcessingParameterSchemaResponse"
"400":
$ref: "#/components/responses/BadRequest"
/api/v1/process:
post:
operationId: processFolder
tags: [Processing]
summary: 处理文件夹扫描结果或显式选择的电化学数据文件
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [data_types]
properties:
folder_path:
type: string
example: "D:\\data\\sample1"
description: 文件夹扫描模式必填;显式 input_files 模式可省略,届时使用首个文件所在目录作为运行上下文
input_files:
type: array
description: 可选的精确主数据文件清单;提供后不再从周围目录自动发现主数据
items:
type: object
required: [path, data_type]
properties:
path: { type: string }
data_type: { type: string, enum: [LSV, CV, EIS, ECSA] }
enabled: { type: boolean, default: true }
data_types:
type: array
minItems: 1
uniqueItems: true
items:
type: string
enum: [LSV, CV, EIS, ECSA, COUPLED]
example: [LSV, EIS]
project_id:
type: string
description: 可选的已有活动项目标识,优先于 project_name;历史复算使用稳定标识绑定原项目
project_name: { type: string }
output_dir:
type: string
description: 可选的显式输出目录
params:
type: object
description: |
处理参数。字段、默认值、范围和选项以
GET /api/v1/process/schema 的响应为准。
内置参数必须存在于该 schema;扩展参数必须由模块的
ProcessingModuleSpec.parameter_keys 声明,未声明字段返回 400。
additionalProperties: true
example:
area: 1.0
potential_mode: manual
potential_offset: 0.0
lsv_target_current: "10,100"
tafel_enabled: false
responses:
"200":
description: 处理成功
content:
application/json:
schema:
$ref: "#/components/schemas/ProcessResult"
"400":
$ref: "#/components/responses/BadRequest"
/api/v1/process/preflight:
post:
operationId: preflightProcessFolder
tags: [Processing]
summary: 预检处理参数、主数据和辅助输入
description: |
与 POST /api/v1/process 使用相同请求结构,不启动正式处理。
HTTP 200 仅表示预检请求完成,调用方仍须检查 preflight.runnable、warnings
和识别出的文件;预检不能保证每个文件后续处理或拟合成功。
requestBody:
$ref: "#/paths/~1api~1v1~1process/post/requestBody"
responses:
"200":
description: 预检完成,包含是否可运行及各模块的匹配情况
content:
application/json:
schema:
type: object
required: [status, data_types, preflight]
properties:
status: { type: string, const: success }
data_types:
type: array
items: { type: string }
preflight:
type: object
required: [runnable, matched_counts, matched_files, checks]
properties:
runnable: { type: boolean }
matched_counts:
type: object
additionalProperties: { type: integer }
matched_files: { type: integer }
by_type:
type: object
additionalProperties: { type: object }
warnings:
type: array
items: { type: string }
checks:
type: object
description: 文件识别、参数完整性、输出目录及可运行状态检查。
additionalProperties: { type: object }
"400":
$ref: "#/components/responses/BadRequest"
/api/v1/process/discover-inputs:
post:
operationId: discoverProcessInputs
tags: [Processing]
summary: 发现并初步识别可加入数据源清单的文件
description: 支持传入 folder_path 或 file_paths;只返回候选信息,不执行预检或处理。
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
folder_path: { type: string }
file_paths:
type: array
maxItems: 2000
items: { type: string }
recursive_scan: { type: boolean, default: false }
data_types:
type: array
items: { type: string }
params: { type: object, additionalProperties: true }
responses:
"200": { description: 候选文件、建议类型和匹配状态 }
"400":
$ref: "#/components/responses/BadRequest"
/api/v1/process/jobs:
get:
operationId: listProcessingJobs
tags: [Processing]
summary: 列出最近后台处理任务
responses:
"200": { description: 任务列表 }
post:
operationId: createProcessingJob
tags: [Processing]
summary: 创建可查询、可取消的后台处理任务
requestBody:
required: true
content:
application/json:
schema: { type: object }
responses:
"202": { description: 任务已排队,返回 job_id }
/api/v1/process/jobs/{job_id}:
get:
operationId: getProcessingJob
tags: [Processing]
summary: 查询后台处理任务、进度和结果
parameters:
- $ref: "#/components/parameters/JobId"
responses:
"200": { description: 任务详情 }
"404": { $ref: "#/components/responses/NotFound" }
/api/v1/process/jobs/{job_id}/cancel:
post:
operationId: cancelProcessingJob
tags: [Processing]
summary: 请求取消处理任务
parameters:
- $ref: "#/components/parameters/JobId"
responses:
"200": { description: 已记录取消请求 }
"409": { description: 任务已结束或不可取消 }
/api/v1/process-zip:
post:
operationId: processZip
tags: [Processing]
summary: 上传 ZIP 并处理数据
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file, data_type]
properties:
file:
type: string
format: binary
description: ZIP 数据文件
data_type: { type: string, enum: [LSV, CV, EIS, ECSA, COUPLED] }
project_name: { type: string }
potential_offset: { type: number }
electrode_area: { type: number }
target_current: { type: string }
tafel_range: { type: string }
coupled_products_file:
type: string
description: Relative path inside the extracted ZIP, or an absolute allowed path, for COUPLED/FE calculation.
coupled_products_sheet:
type: string
description: Excel sheet name or index; ignored for CSV/TXT.
params: { type: string, description: JSON 编码的额外参数 }
responses:
"200":
description: 处理成功
content:
application/json:
schema:
$ref: "#/components/schemas/ProcessResult"
"400":
$ref: "#/components/responses/BadRequest"
"500":
description: 内部服务器错误
# ── Templates ─────────────────────────────────────────────────────────
/api/v1/process/templates:
get:
operationId: listTemplates
tags: [Templates]
summary: 列出参数模板
responses:
"200":
description: 模板列表
post:
operationId: saveTemplate
tags: [Templates]
summary: 保存参数模板
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name, params]
properties:
name: { type: string }
params: { type: object }
responses:
"200":
description: 保存成功
"400":
$ref: "#/components/responses/BadRequest"
/api/v1/process/templates/{template_name}/delete:
post:
operationId: deleteTemplate
tags: [Templates]
summary: 删除参数模板
parameters:
- name: template_name
in: path
required: true
schema: { type: string }
responses:
"200":
description: 删除成功
"400":
$ref: "#/components/responses/BadRequest"
# ── Quality ───────────────────────────────────────────────────────────
/api/v1/quality-report/latest:
get:
operationId: getLatestQualityReport
tags: [Quality]
summary: 获取最新数据质量报告
responses:
"200":
description: 质量报告
"404":
$ref: "#/components/responses/NotFound"
# ── LLM ───────────────────────────────────────────────────────────────
/api/v1/llm/config:
get:
operationId: getLlmConfig
tags: [LLM]
summary: 获取 LLM 配置(API Key 已脱敏)
responses:
"200":
description: LLM 配置
post:
operationId: updateLlmConfig
tags: [LLM]
summary: 更新 LLM 配置
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
provider: { type: string, example: openai }
model: { type: string, example: gpt-4o-mini }
base_url: { type: string }
timeout: { type: integer }
api_key: { type: string }
responses:
"200":
description: 更新成功
"400":
$ref: "#/components/responses/BadRequest"
/api/v1/llm/models:
post:
operationId: discoverLlmModels
tags: [LLM]
summary: 查询所填服务地址的模型列表,不保存密钥或调用对话
description: >-
向 Base URL 的 /models 发起 GET。仅支持 HTTPS 或本机回环 HTTP,
不跟随重定向。省略 api_key 时可使用该服务商已保存或环境变量中的密钥,
但 Base URL 必须与保存地址同源。列表不保证模型支持当前对话接口。
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [provider]
properties:
provider: { type: string, example: openai }
base_url: { type: string, description: 省略时使用已配置的地址 }
api_key: { type: string, writeOnly: true, description: 本次查询使用的密钥,不自动保存 }
responses:
"200":
description: 模型 ID 列表(可以为空),最多返回 2000 项
content:
application/json:
schema:
type: object
properties:
status: { type: string, enum: [success] }
models: { type: array, items: { type: string } }
truncated: { type: boolean }
"400":
description: 配置、权限、网络或接口兼容性错误;返回 status、稳定 code 和脱敏 message,仍可手动配置模型
/api/v1/agent/messages:
post:
operationId: agentChat
tags: [Agent]
summary: 发送消息给 AI Agent
requestBody:
required: true
content:
application/json:
schema:
type: object
description: 普通消息需要 message;确认或取消写操作时提供 approval_id 与 approval_action。
properties:
message: { type: string }
conversation_id: { type: string }
provider: { type: string }
model: { type: string }
project_name: { type: string }
data_type: { type: string, enum: [LSV, CV, EIS, ECSA, COUPLED] }
processing_result: { type: object }
professional_context: { type: object }
approval_id: { type: string, description: AI 返回的待确认操作 ID }
approval_action: { type: string, enum: [approve, decline] }
attachments:
type: array
items: { type: object }
multipart/form-data:
schema:
type: object
required: [message]
properties:
message: { type: string }
conversation_id: { type: string }
provider: { type: string }
model: { type: string }
project_name: { type: string }
data_type: { type: string }
file:
type: string
format: binary
description: ZIP 数据附件
responses:
"200":
description: AI 回复
content:
application/json:
schema:
type: object
properties:
status: { type: string, example: success }
agent_reply: { type: string }
conversation_id: { type: string }
pending_approvals: { type: array, items: { type: object } }
resolved_approval_ids: { type: array, items: { type: string } }
"400":
$ref: "#/components/responses/BadRequest"