v1.4.0 全局搜索+水印5风格+对比列表管理+排行列可配:搜索框拆分(网页顶部居中=选中跳详情; 排行内搜索=添加速度项到本区域查看,可✕移除); 水印预置5种风格(右下角/全图斜纹/底部横条/四角/对角大字)后台可选; 运行速度对比图要对比模型列表可叉掉/清空一键去除/+对比添加; 图表改深色主题适配深色背景; 排行榜新增推理框架列,首字ms默认隐藏,平均解码+最佳解码合并,硬件+推理框架合并,列显示/合并后台⚙️设置可配
This commit is contained in:
+15
-7
@@ -67,6 +67,7 @@ CREATE TABLE IF NOT EXISTS speed_items(
|
||||
model TEXT DEFAULT '',
|
||||
heat INTEGER DEFAULT 0,
|
||||
intro TEXT DEFAULT '',
|
||||
framework TEXT DEFAULT '',
|
||||
count INTEGER DEFAULT 0,
|
||||
remark TEXT DEFAULT '',
|
||||
updated_at TEXT DEFAULT (datetime('now','localtime'))
|
||||
@@ -97,6 +98,10 @@ def _migrate(conn):
|
||||
cols = [r[1] for r in cur.fetchall()]
|
||||
if "hardware" not in cols:
|
||||
conn.execute("ALTER TABLE submissions ADD COLUMN hardware TEXT DEFAULT ''")
|
||||
cur = conn.execute("PRAGMA table_info(speed_items)")
|
||||
scols = [r[1] for r in cur.fetchall()]
|
||||
if "framework" not in scols:
|
||||
conn.execute("ALTER TABLE speed_items ADD COLUMN framework TEXT DEFAULT ''")
|
||||
|
||||
|
||||
def init_db():
|
||||
@@ -359,6 +364,7 @@ def leaderboard(sort="heat", order="desc", limit=500):
|
||||
"MAX(s.created_at) AS last_tested, "
|
||||
"COALESCE(MAX(si.heat), 0) AS heat, "
|
||||
"MAX(si.intro) AS intro, "
|
||||
"MAX(si.framework) AS framework, "
|
||||
"COALESCE(MAX(si.count), 0) AS count_override, "
|
||||
"(SELECT s2.hardware FROM submissions s2 "
|
||||
" WHERE s2.provider=s.provider AND s2.model=s.model AND s2.hardware<>'' "
|
||||
@@ -546,8 +552,8 @@ def touch_speed_item(provider, model):
|
||||
cnt = conn.execute("SELECT COUNT(*) c FROM submissions WHERE provider=? AND model=?",
|
||||
(provider, model)).fetchone()["c"]
|
||||
cur = conn.execute(
|
||||
"INSERT INTO speed_items(provider,model,heat,intro,count) VALUES(?,?,?,?,?)",
|
||||
(provider, model, cnt, "", cnt))
|
||||
"INSERT INTO speed_items(provider,model,heat,intro,framework,count) VALUES(?,?,?,?,?,?)",
|
||||
(provider, model, cnt, "", "", cnt))
|
||||
conn.commit()
|
||||
return cur.lastrowid
|
||||
finally:
|
||||
@@ -580,8 +586,9 @@ def add_speed_item(provider, model, heat=0, intro="", count=0, remark=""):
|
||||
if r:
|
||||
raise ValueError("该速度项已存在")
|
||||
cur = conn.execute(
|
||||
"INSERT INTO speed_items(provider,model,heat,intro,count,remark) VALUES(?,?,?,?,?,?)",
|
||||
(provider, model, int(heat or 0), intro or "", int(count or 0), remark or ""))
|
||||
"INSERT INTO speed_items(provider,model,heat,intro,framework,count,remark) VALUES(?,?,?,?,?,?,?)",
|
||||
(provider, model, int(heat or 0), intro or "", (data.get("framework") or "").strip(),
|
||||
int(count or 0), remark or ""))
|
||||
conn.commit()
|
||||
return cur.lastrowid
|
||||
finally:
|
||||
@@ -593,12 +600,13 @@ def update_speed_item(sid: int, data: dict):
|
||||
conn = _connect()
|
||||
try:
|
||||
conn.execute(
|
||||
"UPDATE speed_items SET provider=?,model=?,heat=?,intro=?,count=?,remark=?,"
|
||||
"UPDATE speed_items SET provider=?,model=?,heat=?,intro=?,framework=?,count=?,remark=?,"
|
||||
"updated_at=datetime('now','localtime') WHERE id=?",
|
||||
((data.get("provider") or "").strip(),
|
||||
(data.get("model") or "").strip(),
|
||||
int(data.get("heat") or 0),
|
||||
(data.get("intro") or "").strip(),
|
||||
(data.get("framework") or "").strip(),
|
||||
int(data.get("count") or 0),
|
||||
(data.get("remark") or "").strip(),
|
||||
sid))
|
||||
@@ -632,8 +640,8 @@ def sync_speed_items():
|
||||
if r0:
|
||||
continue
|
||||
conn.execute(
|
||||
"INSERT INTO speed_items(provider,model,heat,intro,count) VALUES(?,?,?,?,?)",
|
||||
(r["provider"], r["model"], r["c"], "", r["c"]))
|
||||
"INSERT INTO speed_items(provider,model,heat,intro,framework,count) VALUES(?,?,?,?,?,?)",
|
||||
(r["provider"], r["model"], r["c"], "", "", r["c"]))
|
||||
added += 1
|
||||
conn.commit()
|
||||
return added
|
||||
|
||||
Reference in New Issue
Block a user