v2.7.0 一键导出全部历史(GET /api/tests/export JSON, Key打码);左侧三块配置卡片可折叠展开(状态localStorage持久化);置顶/置底按钮高亮蓝渐变高对比配色
This commit is contained in:
+24
@@ -301,6 +301,30 @@ def delete_test(tid: int):
|
||||
conn.close()
|
||||
|
||||
|
||||
def export_tests():
|
||||
"""导出全部历史:每条含 基本字段 + 配置(Key打码) + 生成参数 + 摘要指标,
|
||||
不含逐条采样与完整日志(避免文件过大)"""
|
||||
with _lock:
|
||||
conn = _connect()
|
||||
try:
|
||||
rows = conn.execute(
|
||||
"SELECT id,created_at,status,provider,model,name,config_json,gen_cfg_json,summary_json,error "
|
||||
"FROM tests ORDER BY id").fetchall()
|
||||
out = []
|
||||
for r in rows:
|
||||
d = dict(r)
|
||||
cfg = json.loads(d.pop("config_json") or "{}")
|
||||
if cfg.get("api_key"):
|
||||
cfg["api_key"] = "******"
|
||||
d["config"] = cfg
|
||||
d["gen"] = json.loads(d.pop("gen_cfg_json") or "{}")
|
||||
d["summary"] = json.loads(d.pop("summary_json") or "{}")
|
||||
out.append(d)
|
||||
return out
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
# ───────────────────────── 采样指标 ─────────────────────────
|
||||
|
||||
def add_run(tid: int, run_index: int, metrics: dict, error: str = "", context_length: int = 0):
|
||||
|
||||
Reference in New Issue
Block a user