v2.4.1 评测站同步带硬件:新增 /api/gpu 自动探测本机GPU,评测站同步卡片加硬件/GPU字段(🔍探测可改),发送到评测站时随结果一并提交硬件

This commit is contained in:
2026-09-02 13:38:13 +08:00
parent faabf3b7e1
commit 0f55483eaf
3 changed files with 46 additions and 1 deletions
+25 -1
View File
@@ -833,19 +833,41 @@ function evalSettings() {
return {
url: (localStorage.getItem("evalUrl") || "http://127.0.0.1:16066").replace(/\/+$/, ""),
account: localStorage.getItem("evalAccount") || "默认账号",
hardware: localStorage.getItem("evalHardware") || "",
};
}
function loadEvalSettings() {
const s = evalSettings();
const u = $("#eval-url"), a = $("#eval-account");
const u = $("#eval-url"), a = $("#eval-account"), h = $("#eval-hardware");
if (u) u.value = s.url;
if (a) a.value = s.account;
if (h) h.value = s.hardware;
}
function saveEvalSettings() {
localStorage.setItem("evalUrl", $("#eval-url").value.trim() || "http://127.0.0.1:16066");
localStorage.setItem("evalAccount", $("#eval-account").value.trim() || "默认账号");
localStorage.setItem("evalHardware", $("#eval-hardware").value.trim() || "");
}
async function detectGpu() {
const box = $("#eval-result");
try {
const r = await api("/api/gpu");
if (r.label) {
$("#eval-hardware").value = r.label;
saveEvalSettings();
box.hidden = false; box.className = "conn-result ok";
box.textContent = `✅ 已探测到 GPU${r.label}`;
} else {
box.hidden = false; box.className = "conn-result fail";
box.textContent = "未探测到 GPUnvidia-smi 不可用),可手动填写硬件描述";
}
} catch (e) {
box.hidden = false; box.className = "conn-result fail";
box.textContent = "❌ 探测失败:" + e.message;
}
}
async function testEvalConn() {
@@ -888,6 +910,7 @@ async function sendToEval(id) {
source_site: "llm-speed-tester",
provider: t.provider || "",
model: t.model || "",
hardware: s.hardware,
test_name: t.name || "",
summary: t.summary || {},
gen: t.gen || {},
@@ -951,6 +974,7 @@ function bind() {
$("#btn-test-conn").addEventListener("click", testConnection);
$("#btn-eval-test").addEventListener("click", testEvalConn);
$("#btn-detect-gpu").addEventListener("click", detectGpu);
$("#btn-start").addEventListener("click", startTest);
$("#btn-cancel").addEventListener("click", stopTest);
$("#btn-context-add").addEventListener("click", addContextLength);