v2.7.0 一键导出全部历史(GET /api/tests/export JSON, Key打码);左侧三块配置卡片可折叠展开(状态localStorage持久化);置顶/置底按钮高亮蓝渐变高对比配色

This commit is contained in:
2026-09-06 02:54:16 +08:00
parent edbaedce15
commit f499144465
7 changed files with 122 additions and 14 deletions
+19
View File
@@ -3,6 +3,7 @@
import io
import json
import subprocess
from datetime import datetime
import requests
from flask import Flask, jsonify, request, send_file, send_from_directory
@@ -146,6 +147,24 @@ def start_test():
return jsonify({"ok": True, "id": tid})
@app.route("/api/tests/export")
def export_tests():
"""一键导出全部历史记录(JSON 文件下载,API Key 打码)"""
data = db.export_tests()
payload = {
"ok": True,
"count": len(data),
"exported_at": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"tests": data,
}
resp = app.response_class(json.dumps(payload, ensure_ascii=False),
mimetype="application/json")
resp.headers["Content-Disposition"] = (
'attachment; filename="llm_speed_tests_%s.json"'
% datetime.now().strftime("%Y%m%d_%H%M%S"))
return resp
@app.route("/api/tests", methods=["GET"])
def list_tests():
"""历史记录列表:支持关键词搜索 q、状态 status(逗号多选)、提供商 provider、