magpie-model-speedtest 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/app/app.js +80 -0
- package/app/index.html +30 -0
- package/benchmark.mjs +77 -0
- package/index.mjs +99 -0
- package/package.json +19 -4
- package/page/boot.js +6 -0
- package/page/index.html +5 -0
package/README.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Magpie 模型测速
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
在 Magpie 的「模型测速」页面点「开始测速」,逐个测量当前网关启用的文本模型。每轮都要求抄写同一段英文,最多请求 256 个输出 token。测速会消耗模型额度。
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
magpie plugin add magpie-model-speedtest
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
本地开发可用 `magpie plugin add ./magpie-model-speedtest`。页面服务默认监听 `127.0.0.1:3487`,可在插件选项中修改 `port`。网关端口从 Magpie 的 `gateway.json` 读取,插件用调用方标识 `magpie-model-speedtest` 访问本机网关。无需另外配置供应商密钥。
|
|
10
|
+
|
|
11
|
+
- 默认每个实体模型测一次,按正文 token/s 排序。路由组可单独勾选,命中模型以网关报告为准。
|
|
12
|
+
- 下拉选择一个模型或组可测三轮,三个有效速度样本齐全后显示中位数。
|
|
13
|
+
- 首字延迟包含排队和推理,计时到收到第一段可见正文。正文速度按首末两次正文到达之间的时间计算,排除首批正文。网关或供应商缓冲会影响读数。
|
|
14
|
+
- 供应商同时报告输出和推理用量时,以两者之差作为正文 token 数。首批 token 按其在正文中的字节比例折算,因此速度标 `≈`。缺少推理明细时,按英文正文平均 4 个 UTF-8 字节估算一个 token。用量统计可能含协议开销。
|
|
15
|
+
- 正文集中在 10 毫秒以内到达或整段返回时,显示延迟与总耗时,速度留空。只有推理、流中断、HTTP 错误和单请求超过 60 秒都会逐行标明,队列继续。支持时使用模型公开的最低推理档位。
|
|
16
|
+
- 停止会取消当前请求和后续队列。已完成的结果在本次服务进程内保留到下次测速。
|
package/app/app.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const byId = id => document.getElementById(id)
|
|
2
|
+
const token = document.querySelector('meta[name="session"]').content
|
|
3
|
+
const target = byId("target"), groups = byId("groups")
|
|
4
|
+
let models = [], busy = false, pending = false
|
|
5
|
+
async function api(path, params = {}) {
|
|
6
|
+
const response = await fetch(path, { method: "POST", body: JSON.stringify({ ...params, token }), signal: AbortSignal.timeout(15000) })
|
|
7
|
+
const data = await response.json()
|
|
8
|
+
if (response.status === 403 && data.reload) location.reload()
|
|
9
|
+
if (!response.ok) throw new Error(data.error || `服务返回 HTTP ${response.status},请刷新页面`)
|
|
10
|
+
return data
|
|
11
|
+
}
|
|
12
|
+
function controls() {
|
|
13
|
+
const count = target.value ? 3 : models.filter(model => groups.checked || !model.group).length
|
|
14
|
+
byId("start").disabled = pending || busy || !count
|
|
15
|
+
byId("stop").hidden = !busy
|
|
16
|
+
target.disabled = busy || pending
|
|
17
|
+
groups.disabled = !!target.value || busy || pending
|
|
18
|
+
byId("plan").textContent = `预计 ${count} 次请求 · 串行执行 · 每次最多 256 输出 token`
|
|
19
|
+
}
|
|
20
|
+
function seconds(ms) { return ms == null ? "—" : `${(ms / 1000).toFixed(2)} s` }
|
|
21
|
+
function draw(state) {
|
|
22
|
+
busy = state.running
|
|
23
|
+
controls()
|
|
24
|
+
byId("status").textContent = busy ? `${state.completed} / ${state.count} · 正在测 ${state.current}` :
|
|
25
|
+
state.count ? `${state.stopped ? "已停止" : "已完成"} · ${state.completed} / ${state.count}` : "就绪"
|
|
26
|
+
byId("progress").hidden = !state.count
|
|
27
|
+
byId("progress").max = state.count || 1
|
|
28
|
+
byId("progress").value = state.completed
|
|
29
|
+
const rows = [...state.rows].sort((left, right) => (right.speed ?? -1) - (left.speed ?? -1))
|
|
30
|
+
const body = document.querySelector("tbody")
|
|
31
|
+
body.replaceChildren()
|
|
32
|
+
for (const row of rows) {
|
|
33
|
+
const tr = body.insertRow()
|
|
34
|
+
const label = tr.insertCell()
|
|
35
|
+
label.textContent = row.id
|
|
36
|
+
if (row.id.startsWith("group/") || row.round > 1 || row.actual && row.actual !== row.id) {
|
|
37
|
+
const detail = document.createElement("small")
|
|
38
|
+
detail.textContent = `第 ${row.round} 轮` + (row.actual && row.actual !== row.id ? ` · ${row.actual}` : row.id.startsWith("group/") ? " · 未报告实际模型" : "")
|
|
39
|
+
label.append(detail)
|
|
40
|
+
}
|
|
41
|
+
for (const value of [row.speed == null ? "—" : `≈${row.speed.toFixed(1)}`, seconds(row.ttft),
|
|
42
|
+
row.tokens == null ? "—" : `${row.exact ? "" : "≈"}${row.tokens}`, seconds(row.total), row.error || row.note]) tr.insertCell().textContent = value
|
|
43
|
+
}
|
|
44
|
+
const samples = rows.filter(row => row.speed != null)
|
|
45
|
+
byId("summary").textContent = !busy && samples.length === 3 && new Set(samples.map(row => row.id)).size === 1 ?
|
|
46
|
+
`三轮正文速度中位数 ≈${samples[1].speed.toFixed(1)} token/s` : ""
|
|
47
|
+
}
|
|
48
|
+
async function loadModels() {
|
|
49
|
+
models = await api("models")
|
|
50
|
+
const previous = target.value
|
|
51
|
+
target.length = 1
|
|
52
|
+
for (const group of [false, true]) {
|
|
53
|
+
const section = document.createElement("optgroup")
|
|
54
|
+
section.label = group ? "路由组 · 单项复测 3 轮" : "单模型复测 · 3 轮"
|
|
55
|
+
for (const model of models.filter(item => item.group === group)) section.append(new Option(model.id, model.id))
|
|
56
|
+
target.append(section)
|
|
57
|
+
}
|
|
58
|
+
target.value = previous
|
|
59
|
+
}
|
|
60
|
+
function report(error) { byId("notice").textContent = error.message }
|
|
61
|
+
target.onchange = groups.onchange = controls
|
|
62
|
+
byId("start").onclick = async () => {
|
|
63
|
+
pending = true
|
|
64
|
+
const id = target.value
|
|
65
|
+
controls()
|
|
66
|
+
try {
|
|
67
|
+
await loadModels()
|
|
68
|
+
draw(await api("start", { id, groups: groups.checked }))
|
|
69
|
+
} catch (error) { report(error) }
|
|
70
|
+
finally { pending = false; controls() }
|
|
71
|
+
}
|
|
72
|
+
byId("stop").onclick = async () => { try { await api("stop") } catch (error) { report(error) } }
|
|
73
|
+
async function poll() {
|
|
74
|
+
try {
|
|
75
|
+
if (!models.length) await loadModels()
|
|
76
|
+
if (!pending) draw(await api("state"))
|
|
77
|
+
} catch (error) { report(error) }
|
|
78
|
+
setTimeout(poll, busy ? 500 : 1800)
|
|
79
|
+
}
|
|
80
|
+
poll()
|
package/app/index.html
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
4
|
+
<meta name="session" content="__SESSION__">
|
|
5
|
+
<title>模型测速</title>
|
|
6
|
+
<style>
|
|
7
|
+
:root {color-scheme:light dark;font:15px/1.55 system-ui,sans-serif;color:CanvasText;background:Canvas}
|
|
8
|
+
body {max-width:1160px;margin:clamp(20px,5vw,64px) auto;padding:0 20px}
|
|
9
|
+
h1 {font-size:clamp(28px,4vw,44px);letter-spacing:-.035em;margin:0}
|
|
10
|
+
header p,small {color:GrayText} .controls {display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:24px 0}
|
|
11
|
+
select,button {font:inherit;border:1px solid GrayText;border-radius:7px;padding:7px 12px;color:inherit;background:Canvas}
|
|
12
|
+
#start {background:#086151;border-color:#086151;color:white;font-weight:600} button:disabled {opacity:.5}
|
|
13
|
+
select {max-width:100%} progress {width:100%;accent-color:#138273;height:6px}
|
|
14
|
+
.scroll {overflow-x:auto} table {width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}
|
|
15
|
+
th,td {text-align:right;padding:10px 8px;border-bottom:1px solid color-mix(in srgb,CanvasText 16%,transparent);white-space:nowrap}
|
|
16
|
+
th {font-size:13px;color:GrayText} td:first-child,th:first-child,td:last-child,th:last-child {text-align:left}
|
|
17
|
+
small {display:block} #notice {color:#b05917} #summary {font-weight:600}
|
|
18
|
+
</style>
|
|
19
|
+
<header><h1>模型测速</h1><p>比较可见正文的输出速度与首字延迟。测速会使用模型额度。</p></header>
|
|
20
|
+
<div class="controls">
|
|
21
|
+
<select id="target" aria-label="选择测速范围"><option value="">全部模型 · 1 轮</option></select>
|
|
22
|
+
<label><input type="checkbox" id="groups"> 包含路由组</label>
|
|
23
|
+
<button id="start" disabled>开始测速</button><button id="stop" hidden>停止</button>
|
|
24
|
+
</div>
|
|
25
|
+
<p id="plan"></p><p id="status" role="status">正在读取模型…</p>
|
|
26
|
+
<progress id="progress" value="0" max="1" hidden></progress>
|
|
27
|
+
<p id="notice" role="alert"></p><p id="summary"></p>
|
|
28
|
+
<div class="scroll"><table><thead><tr><th>供应商 / 模型</th><th>正文 token/s</th><th>首字</th><th>正文 token</th><th>总耗时</th><th>状态</th></tr></thead><tbody></tbody></table></div>
|
|
29
|
+
<script src="app.js"></script>
|
|
30
|
+
</html>
|
package/benchmark.mjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const prompt = `Copy the passage below verbatim. Begin with The.
|
|
2
|
+
|
|
3
|
+
The path from the house to the river runs through a quiet garden. Small birds rest on the fence and watch the water. In the morning I walk slowly past the old apple tree and turn left at the wooden gate. A narrow bridge leads to a field of green grass. Beyond the field a small boat is waiting at the edge of the river. The water is clear enough to see stones on the river bed. I sit on a flat rock and listen to the wind in the trees.`
|
|
4
|
+
const headers = { authorization: "Bearer magpie-model-speedtest", "content-type": "application/json" }
|
|
5
|
+
|
|
6
|
+
export async function catalog(base) {
|
|
7
|
+
const response = await fetch(`${base}/v1/models`, { headers, signal: AbortSignal.timeout(10000), redirect: "error" })
|
|
8
|
+
if (!response.ok) throw new Error(`模型目录 HTTP ${response.status}`)
|
|
9
|
+
const { data } = await response.json()
|
|
10
|
+
if (!Array.isArray(data)) throw new Error("网关未返回模型目录")
|
|
11
|
+
return data.filter(model => typeof model.id === "string" && (!model.modalities?.output || model.modalities.output.includes("text")))
|
|
12
|
+
.map(model => ({
|
|
13
|
+
id: model.id, group: model.id.startsWith("group/"),
|
|
14
|
+
effort: ["none", "minimal", "low"].find(level => model.reasoning_levels?.includes(level)),
|
|
15
|
+
cap: Math.min(256, model.max_output_tokens || 256)
|
|
16
|
+
}))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function measure(base, model, signal) {
|
|
20
|
+
const started = performance.now()
|
|
21
|
+
const response = await fetch(`${base}/v1/chat/completions`, {
|
|
22
|
+
method: "POST", headers, redirect: "error", signal,
|
|
23
|
+
body: JSON.stringify({ model: model.id, messages: [{ role: "user", content: prompt }], stream: true,
|
|
24
|
+
stream_options: { include_usage: true }, max_tokens: model.cap, reasoning_effort: model.effort })
|
|
25
|
+
})
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
await response.body?.cancel()
|
|
28
|
+
throw new Error(`HTTP ${response.status} ${response.statusText}`.trim())
|
|
29
|
+
}
|
|
30
|
+
const routed = response.headers.get("x-magpie-model")
|
|
31
|
+
if (response.headers.get("content-type")?.includes("application/json")) {
|
|
32
|
+
const reply = await response.json()
|
|
33
|
+
if (reply.error || !reply.choices?.[0]?.message?.content) throw new Error("网关未返回可见正文")
|
|
34
|
+
const total = performance.now() - started
|
|
35
|
+
return { actual: routed || reply.model, total, ttft: total, speed: null, tokens: null, note: "整段返回" }
|
|
36
|
+
}
|
|
37
|
+
return readStream(response.body, started, routed)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function readStream(body, started, routed, now = () => performance.now()) {
|
|
41
|
+
const decoder = new TextDecoder()
|
|
42
|
+
let buffer = "", first, last, firstBytes = 0, bytes = 0, model, usage, finished = false, done = false
|
|
43
|
+
for await (const chunk of body) {
|
|
44
|
+
const arrival = now()
|
|
45
|
+
buffer += decoder.decode(chunk, { stream: true })
|
|
46
|
+
const frames = buffer.split(/\r?\n\r?\n/)
|
|
47
|
+
buffer = frames.pop()
|
|
48
|
+
for (const frame of frames) {
|
|
49
|
+
const payload = frame.split(/\r?\n/).filter(line => line.startsWith("data:")).map(line => line.slice(5).trimStart()).join("\n")
|
|
50
|
+
if (!payload) continue
|
|
51
|
+
if (payload === "[DONE]") { done = true; break }
|
|
52
|
+
const event = JSON.parse(payload)
|
|
53
|
+
if (event.error) throw new Error(`网关流错误${event.error.code ? ` (${String(event.error.code).slice(0, 60)})` : ""}`)
|
|
54
|
+
model = event.model || model
|
|
55
|
+
usage = event.usage || usage
|
|
56
|
+
const choice = event.choices?.[0]
|
|
57
|
+
if (choice?.finish_reason === "error" || choice?.finish_reason === "content_filter") throw new Error(`生成终止 (${choice.finish_reason})`)
|
|
58
|
+
finished ||= !!choice?.finish_reason
|
|
59
|
+
const text = choice?.delta?.content
|
|
60
|
+
if (typeof text !== "string" || !text) continue
|
|
61
|
+
bytes += Buffer.byteLength(text)
|
|
62
|
+
first ??= arrival
|
|
63
|
+
last = arrival
|
|
64
|
+
if (first === arrival) firstBytes = bytes
|
|
65
|
+
}
|
|
66
|
+
if (done) break
|
|
67
|
+
}
|
|
68
|
+
if (!done && (!finished || buffer.trim())) throw new Error("流提前中断")
|
|
69
|
+
if (!bytes) throw new Error("没有可见正文(可能已用完输出预算)")
|
|
70
|
+
const reasoning = usage?.completion_tokens_details?.reasoning_tokens
|
|
71
|
+
const exact = Number.isInteger(reasoning) && reasoning >= 0 && Number.isInteger(usage?.completion_tokens) && usage.completion_tokens > reasoning
|
|
72
|
+
const tokens = exact ? usage.completion_tokens - reasoning : Math.max(1, Math.round(bytes / 4))
|
|
73
|
+
const window = last - first
|
|
74
|
+
const speed = window >= 10 ? tokens * (1 - firstBytes / bytes) * 1000 / window : null
|
|
75
|
+
return { actual: routed || model, total: now() - started, ttft: first - started, speed, tokens, exact,
|
|
76
|
+
note: speed === null ? "正文集中到达" : exact ? "用量计数,速率为估算" : "按英文正文约 4 字节/token 估算" }
|
|
77
|
+
}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { createServer } from "node:http"
|
|
2
|
+
import { randomBytes } from "node:crypto"
|
|
3
|
+
import { readFile } from "node:fs/promises"
|
|
4
|
+
import { join } from "node:path"
|
|
5
|
+
import { catalog, measure } from "./benchmark.mjs"
|
|
6
|
+
|
|
7
|
+
async function gateway(directory) {
|
|
8
|
+
const { addr } = JSON.parse(await readFile(join(directory, "gateway.json"), "utf8"))
|
|
9
|
+
const port = new URL(`http://${addr}`).port
|
|
10
|
+
if (!port) throw new Error("无法读取 Magpie 网关端口")
|
|
11
|
+
return `http://127.0.0.1:${port}`
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let server
|
|
15
|
+
export default {
|
|
16
|
+
id: "magpie-model-speedtest",
|
|
17
|
+
async server(input, options = {}) {
|
|
18
|
+
if (server?.listening) return {}
|
|
19
|
+
const port = Number(options.port || 3487)
|
|
20
|
+
const token = randomBytes(32).toString("hex")
|
|
21
|
+
let state = { rows: [], count: 0, completed: 0, running: false }
|
|
22
|
+
let control
|
|
23
|
+
async function run(base, models, rounds, signal) {
|
|
24
|
+
try {
|
|
25
|
+
for (let round = 1; round <= rounds; round++) {
|
|
26
|
+
for (const model of models) {
|
|
27
|
+
if (signal.aborted) return
|
|
28
|
+
state.current = model.id
|
|
29
|
+
const row = { id: model.id, round }
|
|
30
|
+
try {
|
|
31
|
+
const deadline = AbortSignal.timeout(60000)
|
|
32
|
+
Object.assign(row, await measure(base, model, AbortSignal.any([signal, deadline])))
|
|
33
|
+
} catch (error) {
|
|
34
|
+
if (signal.aborted) return
|
|
35
|
+
row.error = error.name === "TimeoutError" ? "60 秒超时" : error.message
|
|
36
|
+
}
|
|
37
|
+
state.rows.push(row)
|
|
38
|
+
state.completed++
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} finally {
|
|
42
|
+
state.running = false
|
|
43
|
+
state.current = null
|
|
44
|
+
state.stopped = signal.aborted
|
|
45
|
+
control = undefined
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
server = createServer(async (req, res) => {
|
|
49
|
+
const path = req.url?.split("?")[0]
|
|
50
|
+
const reply = (status, value) => { res.writeHead(status, { "Content-Type": "application/json" }); res.end(JSON.stringify(value)) }
|
|
51
|
+
res.setHeader("Cache-Control", "no-store")
|
|
52
|
+
res.setHeader("Referrer-Policy", "no-referrer")
|
|
53
|
+
res.setHeader("X-Content-Type-Options", "nosniff")
|
|
54
|
+
if (![`127.0.0.1:${port}`, `localhost:${port}`].includes(req.headers.host)) return reply(403, {})
|
|
55
|
+
const origin = req.headers.origin
|
|
56
|
+
if (origin && origin !== "null" && origin !== `http://${req.headers.host}`) return reply(403, {})
|
|
57
|
+
try {
|
|
58
|
+
if (req.method === "GET" && path === "/") {
|
|
59
|
+
const html = await readFile(new URL("./app/index.html", import.meta.url), "utf8")
|
|
60
|
+
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" })
|
|
61
|
+
return res.end(html.replace("__SESSION__", token))
|
|
62
|
+
}
|
|
63
|
+
if (req.method === "GET" && path === "/app.js") {
|
|
64
|
+
res.writeHead(200, { "Content-Type": "application/javascript; charset=utf-8" })
|
|
65
|
+
return res.end(await readFile(new URL("./app/app.js", import.meta.url)))
|
|
66
|
+
}
|
|
67
|
+
if (req.method !== "POST") return reply(405, {})
|
|
68
|
+
let text = ""
|
|
69
|
+
for await (const part of req) {
|
|
70
|
+
text += part
|
|
71
|
+
if (text.length > 8192) return reply(413, {})
|
|
72
|
+
}
|
|
73
|
+
let args
|
|
74
|
+
try { args = JSON.parse(text) } catch { return reply(400, {}) }
|
|
75
|
+
if (origin) res.setHeader("Access-Control-Allow-Origin", origin)
|
|
76
|
+
if (args?.token !== token) return reply(403, { reload: true })
|
|
77
|
+
if (path === "/state") return reply(200, state)
|
|
78
|
+
if (path === "/stop") { control?.abort(); return reply(200, {}) }
|
|
79
|
+
const base = await gateway(input.directory)
|
|
80
|
+
if (path === "/models") return reply(200, await catalog(base))
|
|
81
|
+
if (path !== "/start") return reply(404, {})
|
|
82
|
+
const available = await catalog(base)
|
|
83
|
+
if (state.running) return reply(409, { error: "已有测速正在运行" })
|
|
84
|
+
const models = available.filter(model => args.id ? model.id === args.id : args.groups === true || !model.group)
|
|
85
|
+
if (!models.length) return reply(400, { error: "当前没有符合条件的模型" })
|
|
86
|
+
const rounds = args.id ? 3 : 1
|
|
87
|
+
control = new AbortController()
|
|
88
|
+
state = { rows: [], running: true, count: models.length * rounds, completed: 0 }
|
|
89
|
+
void run(base, models, rounds, control.signal)
|
|
90
|
+
reply(200, state)
|
|
91
|
+
} catch (error) {
|
|
92
|
+
if (!res.headersSent) reply(502, { error: error.message })
|
|
93
|
+
else res.end()
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
await new Promise((resolve, reject) => server.once("error", reject).listen(port, "127.0.0.1", resolve))
|
|
97
|
+
return {}
|
|
98
|
+
}
|
|
99
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magpie-model-speedtest",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "One-click streaming token speed and first-text latency benchmarks for models in your Magpie gateway.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.mjs",
|
|
7
|
+
"files": ["index.mjs", "benchmark.mjs", "page", "app", "README.md"],
|
|
8
|
+
"keywords": ["magpie", "magpie-plugin", "opencode", "opencode-plugin", "benchmark", "tokens-per-second"],
|
|
9
|
+
"scripts": {"test": "node --test test/*.test.mjs"},
|
|
10
|
+
"magpie": {
|
|
11
|
+
"page": {
|
|
12
|
+
"title": "Model Speed Test",
|
|
13
|
+
"titles": {"zh": "模型测速", "zh-TW": "模型測速"},
|
|
14
|
+
"file": "page/index.html",
|
|
15
|
+
"service": {"port": 3487, "option": "port"}
|
|
16
|
+
},
|
|
17
|
+
"options": {"port": 3487},
|
|
18
|
+
"permissions": [],
|
|
19
|
+
"summary": {"zh": "一键比较模型正文输出速度和首字延迟,可选路由组和三轮复测。", "en": "Benchmark streaming throughput and time to first text across enabled models."}
|
|
20
|
+
}
|
|
21
|
+
}
|
package/page/boot.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
(async () => {
|
|
2
|
+
await window.magpie?.ready
|
|
3
|
+
const options = await window.magpie?.options?.get?.()
|
|
4
|
+
const base = window.magpie?.service || `http://127.0.0.1:${Number(options?.port) || 3487}`
|
|
5
|
+
location.replace(base.replace(/\/?$/, "/"))
|
|
6
|
+
})().catch(() => { document.querySelector("#loading").textContent = "连接失败,请重新打开模型测速。" })
|