settings: what routing does sits under Models › Routing, and the Routing page opens it

The scattered settings audit after netube99 on X. Ask again after a
refusal, the Retry-After cap and the intent classifier's timeout were
under Models › Replies beside rows about a reply's content, and Busy
models last sat in Network and sharing, far from the routing it changes.
The four are now one Routing section under Models, after Replies, and the
Routing page's header has a Settings › button that opens Settings at that
section with its first row lit. The docs (reference.md, the site's
plugins page in en, zh and ja) name the new place.

Run (mote, mote-run):
- settings-places, retry-after-cap-setting, refusal-retries-setting,
  classify-timeout-setting, model-load, i18n-keys and bare-ids, both
  engines: all pass.
- mobile-web against origin/main fdabddeb4 (a git repo made in the copy
  from git archive, since mote-run carries no .git): 30 of 30. It now
  takes the new Settings › button out of the Routing page until main has
  it, as it does for other new rows.
- go test -run 'Budget|I18n|Strings' ./internal/gui: ok. gofmt clean.

Broken by hand:
- the three rows back in Replies and busyLoadRow left where it was:
  settings-places and retry-after-cap-setting 20 of 20 red (chromium);
- the Settings › button's click handler off: settings-places 10 of 10 red.

Not tried: the real app; the GUI suite beyond these files runs with the
rest of this audit's changes.
This commit is contained in:
yetone
2026-11-09 22:42:58 +08:00
parent 7d177985f6
commit a6e4cf7635
14 changed files with 84 additions and 38 deletions
+1 -1
View File
@@ -2184,7 +2184,7 @@ it as above.
refuses before any of it is said rests nobody: it is about what was asked,
not the account. By default the same request is asked of the model's other
accounts, then the routing group's other members, until one answers.
Settings › Models › Replies › *Ask again after a refusal* sets how many more
Settings › Models › Routing › *Ask again after a refusal* sets how many more
are asked: 1, 2 or 3, or *Never ask again*. When nobody else is asked, an
agent on Anthropic's Messages API (Claude Code) gets the refusal as the
vendor said it, `stop_reason` `refusal` with its category, which Claude Code
+2 -1
View File
@@ -21677,7 +21677,8 @@ function renderReplies(s, keep) {
const u = segRow("claudeTuiRow", t("Claude Code's interactive mode"),
t("A Claude subscription runs Claude Code as a person does, in its interactive mode, where the plan counts a request at about half of what -p uses. On, a request runs as -p only when Anthropic refuses its agent's prompt there. Off runs every request as claude -p"),
onOff, s.claudePrintMode ? "off" : "on", (v) => { claudeMode = null; savePrefs({ ...keep, claudePrintMode: v === "off" }); });
box.append(r, l, f, a, k, c, u);
box.append(r, l, c, u);
$("#routeList").replaceChildren(f, a, k, $("#busyLoadRow"));
}
// renderDisabledModels: models turned off for every request (#1867), a row per pattern
+7 -4
View File
@@ -347,10 +347,6 @@
<div class="who"><div class="name" data-t>Model ids without the provider</div><div class="sub" data-t>The gateway’s model list also names each model by its own id, as gpt-5.6-sol beside codex/gpt-5.6-sol, for apps moved from another proxy. One that several providers serve goes to them in the Providers order</div></div>
<div id="bareIdsSegs"></div>
</div>
<div class="row pref" id="busyLoadRow">
<div class="who"><div class="name" data-t>Busy models last</div><div class="sub" data-t>A model its plugin says is busier than this goes after the others a request could go to, as its vendor makes it wait. One with no load reported in the last 5 minutes keeps its place</div></div>
<div id="busyLoadSegs"></div>
</div>
</div>
<div class="row-head"><span class="label" data-t>Local network</span></div>
<div class="list prefs" id="lanList"></div>
@@ -367,6 +363,13 @@
<div class="list prefs" id="searchList"></div>
<div class="row-head"><span class="label" data-t>Replies</span></div>
<div class="list prefs" id="replyList"></div>
<div class="row-head"><span class="label" data-t>Routing</span></div>
<div class="list prefs" id="routeList">
<div class="row pref" id="busyLoadRow">
<div class="who"><div class="name" data-t>Busy models last</div><div class="sub" data-t>A model its plugin says is busier than this goes after the others a request could go to, as its vendor makes it wait. One with no load reported in the last 5 minutes keeps its place</div></div>
<div id="busyLoadSegs"></div>
</div>
</div>
<div class="row-head"><span class="label" data-t>Disabled models</span></div>
<div class="list prefs" id="disabledModelsList"></div>
</section>
@@ -1,7 +1,8 @@
// Settings › Network and sharing's gateway rows (the gateway plugin's part
// of Settings): its port, model ids without the provider, sharing on the
// local network and the addresses let in, and the web pages that may call
// it. Run after app.js, whose helpers it shares (el, segs, input, api,
// it; and a busy model's place, drawn into Settings › Models › Routing.
// Run after app.js, whose helpers it shares (el, segs, input, api,
// writingPrefs), and before start.js draws Settings.
// renderPort: the gateway's address on this computer (Magic_zero on Discord:
@@ -78,13 +79,14 @@ function renderPort(s) {
// lists each model by its own id as well, gpt-5.6-sol beside
// codex/gpt-5.6-sol. Posted on its own; off by default.
function renderBareIds(s) {
renderBusyLoad(s); // the row under it
renderBusyLoad(s); // Models › Routing's row
$("#bareIdsSegs").replaceChildren(segs([[false, t("Off")], [true, t("On")]], !!s.bareModelIDs, (on) =>
writingPrefs(api("settings/bare-ids", { on })).then((ns) => { prefs = state.settings = ns; renderSettings(); })
.catch((e) => { status(t(e.message), "err"); renderSettings(); })));
}
// renderBusyLoad: the load past which a model its plugin says is busy
// renderBusyLoad, in Settings › Models › Routing with the other rows on
// where a request goes: the load past which a model its plugin says is busy
// (magpie.load) goes behind the others (settings.BusyLoad, axelburks on
// Discord). Custom… opens a field for any other number, 1 to 9999, which
// is then shown as its own choice; Enter or Apply saves it, Escape closes
@@ -22,6 +22,7 @@ magpie.plugin("routing", (ctx) => {
html: `
<div class="row-head"><span class="label" data-t>Routing</span><span class="rt-livedot" aria-hidden="true"></span><span class="note" data-t>live, as the gateway decides</span><span class="grow"></span>
<button class="text rt-togroups" type="button" id="rtToGroups" data-feature="groups"><span data-t>Routing groups</span> ›</button>
<button class="text rt-toset" type="button" id="rtToSet"><span data-t>Settings</span> ›</button>
<button class="text rt-mask" id="rtMask" aria-pressed="false" data-tt="Mask the accounts on every page — email addresses and account names — for a screenshot to share"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9.9 4.2A10.4 10.4 0 0 1 12 4c6.5 0 10 8 10 8a17.6 17.6 0 0 1-2.2 3.2M6.6 6.6C3.9 8.4 2 12 2 12s3.5 8 10 8a9.7 9.7 0 0 0 5.4-1.6M9.9 9.9a3 3 0 0 0 4.2 4.2M2 2l20 20"/></svg><span data-t>Hide accounts</span></button></div>
<section class="rt" id="rt"></section>
<div class="rt-more" id="rtMore"></div>
@@ -55,6 +56,10 @@ function routingPage(part) {
// the groups' way in where the header's row has no tab for them (markNav)
const toGroups = $("#rtToGroups");
if (toGroups) toGroups.onclick = async () => { if (await window.show("groups")) openedFrom(toGroups); };
// what routing does when an account refuses or every one rests, and a
// busy model's place, are set in Settings › Models › Routing
const toSet = $("#rtToSet");
if (toSet) toSet.onclick = (e) => openSettingsAt(e, "models", "#routeList .row");
const NS = "http://www.w3.org/2000/svg";
const still = calm;
const shown = () => !$("#view-routing").hidden && !document.hidden;
@@ -10,11 +10,11 @@ const { reach, watchSettingsReads, settingsDrawn } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const words = {
en: { name: "Intent classifier timeout", head: "Replies", sec: (n) => `${n} s`, sub: "A slow classifier may need longer" },
zh: { name: "意图判断超时", head: "回复", sec: (n) => `${n} 秒`, sub: "较慢的判断模型可能需要更长时间" },
"zh-TW": { name: "意圖判斷逾時", head: "回覆", sec: (n) => `${n} 秒`, sub: "較慢的判斷模型可能需要更長時間" },
ja: { name: "インテント判定のタイムアウト", head: "応答", sec: (n) => `${n} 秒`, sub: "遅い分類モデル" },
de: { name: "Zeitlimit für den Absicht-Klassifikator", head: "Antworten", sec: (n) => `${n} s`, sub: "Ein langsamer Klassifikator" },
en: { name: "Intent classifier timeout", head: "Routing", sec: (n) => `${n} s`, sub: "A slow classifier may need longer" },
zh: { name: "意图判断超时", head: "路由", sec: (n) => `${n} 秒`, sub: "较慢的判断模型可能需要更长时间" },
"zh-TW": { name: "意圖判斷逾時", head: "路由", sec: (n) => `${n} 秒`, sub: "較慢的判斷模型可能需要更長時間" },
ja: { name: "インテント判定のタイムアウト", head: "ルーティング", sec: (n) => `${n} 秒`, sub: "遅い分類モデル" },
de: { name: "Zeitlimit für den Absicht-Klassifikator", head: "Weiterleitung", sec: (n) => `${n} s`, sub: "Ein langsamer Klassifikator" },
};
function serve(lang, saved, own) {
@@ -54,7 +54,7 @@ async function open(engine, lang, width, saved, own, t) {
await watchSettingsReads(page);
await page.goto("http://magpie.test/?view=settings&tab=models");
await settingsDrawn(page); // rows found are the ones that stay (#1659)
const row = page.locator("#replyList #classifyTimeoutRow");
const row = page.locator("#routeList #classifyTimeoutRow");
await row.waitFor();
return { page, row, errors };
}
@@ -85,7 +85,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
});
assert(fit, `${part} fits at ${width}`);
}
assert.equal(await page.locator("#replyList").evaluate((l) => l.previousElementSibling.textContent.trim()), w.head);
assert.equal(await page.locator("#routeList").evaluate((l) => l.previousElementSibling.textContent.trim()), w.head);
assert.deepEqual(await row.locator(".segs button").allTextContents(), [8, 15, 30, 60].map(w.sec));
assert.equal(await row.locator(".segs button[aria-pressed=true]").textContent(), w.sec(8), "8 s at first");
+7
View File
@@ -378,6 +378,13 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await current.locator("#claudeTuiRow").evaluate((r) => r.remove());
await current.waitForTimeout(350);
}
// The Routing page's Settings › button is new: until BASE_REF
// has it, the page is compared with the button taken out;
// settings-places.test.cjs covers it.
if (view === "routing" && !baselineFile("plugins/routing/client.js").toString().includes("rtToSet")) {
await current.locator("#rtToSet").evaluate((b) => b.remove());
await current.waitForTimeout(350);
}
// A setting row's line wraps whole (arculongus on Discord):
// until BASE_REF has that, the page is compared with the lines
// held to one line as they were; settings-lines-wrap.test.cjs
+4 -4
View File
@@ -148,7 +148,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", server(lang, posted));
await watchSettingsReads(page);
if (!web) await page.route("**/boot.js", (r) => r.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light"};` }));
await page.goto("http://magpie.test/?view=settings&tab=network");
await page.goto("http://magpie.test/?view=settings&tab=models");
await settingsDrawn(page);
const segs = page.locator("#busyLoadSegs .opt");
await segs.first().waitFor();
@@ -188,7 +188,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
page.on("pageerror", (e) => errors.push(e.message));
await page.route("**/*", server(lang, posted));
await watchSettingsReads(page);
await page.goto("http://magpie.test/?view=settings&tab=network");
await page.goto("http://magpie.test/?view=settings&tab=models");
await settingsDrawn(page);
const row = page.locator("#busyLoadRow"), sub = row.locator(".sub"), field = row.locator("input.busy-load-at");
const custom = row.locator(".opt", { hasText: w.custom }), apply = row.locator("#busyLoadSegs .val button").first();
@@ -256,7 +256,7 @@ test("a threshold past 100 set by hand is shown as picked", async (t) => {
const errors = [];
page.on("pageerror", (e) => errors.push(e.message));
await page.route("**/*", server("en", [], { busyLoad: 150 }));
await page.goto("http://magpie.test/?view=settings&tab=network");
await page.goto("http://magpie.test/?view=settings&tab=models");
const segs = page.locator("#busyLoadSegs .opt");
await segs.first().waitFor();
assert.deepEqual((await segs.allTextContents()).map((s) => s.trim()), ["Off", "Over 50%", "Over 70%", "Over 80%", "Over 90%", "Over 150%", "Custom…"]);
@@ -271,7 +271,7 @@ test("a threshold set by hand is shown as picked", async (t) => {
const errors = [];
page.on("pageerror", (e) => errors.push(e.message));
await page.route("**/*", server("en", [], { busyLoad: 75 }));
await page.goto("http://magpie.test/?view=settings&tab=network");
await page.goto("http://magpie.test/?view=settings&tab=models");
const segs = page.locator("#busyLoadSegs .opt");
await segs.first().waitFor();
assert.deepEqual((await segs.allTextContents()).map((s) => s.trim()), ["Off", "Over 50%", "Over 70%", "Over 75%", "Over 80%", "Over 90%", "Custom…"]);
@@ -15,11 +15,11 @@ const { reach, watchSettingsReads, settingsDrawn } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const words = {
en: { name: "Ask again after a refusal", head: "Replies", never: "Never ask again", all: "All", sub: "Claude Code then switches to its own fallback model" },
zh: { name: "被拒答后再问", head: "回复", never: "不再问", all: "全部", sub: "Claude Code 随后会像直连 Anthropic API 时一样" },
"zh-TW": { name: "被拒答後再問", head: "回覆", never: "不再問", all: "全部", sub: "Claude Code 隨後會像直連 Anthropic API 時一樣" },
ja: { name: "拒否のあと聞き直す", head: "応答", never: "聞き直さない", all: "すべて", sub: "フォールバックモデルに切り替えます" },
de: { name: "Nach einer Ablehnung erneut fragen", head: "Antworten", never: "Nie", all: "Alle", sub: "wechselt dann selbst zu seinem Ausweichmodell" },
en: { name: "Ask again after a refusal", head: "Routing", never: "Never ask again", all: "All", sub: "Claude Code then switches to its own fallback model" },
zh: { name: "被拒答后再问", head: "路由", never: "不再问", all: "全部", sub: "Claude Code 随后会像直连 Anthropic API 时一样" },
"zh-TW": { name: "被拒答後再問", head: "路由", never: "不再問", all: "全部", sub: "Claude Code 隨後會像直連 Anthropic API 時一樣" },
ja: { name: "拒否のあと聞き直す", head: "ルーティング", never: "聞き直さない", all: "すべて", sub: "フォールバックモデルに切り替えます" },
de: { name: "Nach einer Ablehnung erneut fragen", head: "Weiterleitung", never: "Nie", all: "Alle", sub: "wechselt dann selbst zu seinem Ausweichmodell" },
};
function serve(lang, saved) {
@@ -63,7 +63,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await watchSettingsReads(page);
await page.goto("http://magpie.test/?view=settings&tab=models");
await settingsDrawn(page); // rows found are the ones that stay (#1659)
const row = page.locator("#replyList #refusalRetriesRow");
const row = page.locator("#routeList #refusalRetriesRow");
await row.waitFor();
// scrolled to as a reader does, with the wheel: WebKit at 420 put
// back a scroll made from script
@@ -86,7 +86,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
});
assert(fit, `${part} fits at ${width}`);
}
assert.equal(await page.locator("#replyList").evaluate((l) => l.previousElementSibling.textContent.trim()), w.head);
assert.equal(await page.locator("#routeList").evaluate((l) => l.previousElementSibling.textContent.trim()), w.head);
const opts = row.locator(".segs button");
assert.deepEqual(await opts.allTextContents(), [w.never, "1", "2", "3", w.all]);
const all = row.locator(".segs button", { hasText: w.all });
@@ -15,11 +15,11 @@ const { reach, watchSettingsReads, settingsDrawn } = require("./reader.cjs");
const assets = path.resolve(__dirname, "../assets");
const words = {
en: { name: "Longest wait an agent is told", head: "Replies", min: (n) => `${n} min`, none: "No limit", sub: "The accounts rest as long either way" },
zh: { name: "告诉智能体的最长等待", head: "回复", min: (n) => `${n} 分钟`, none: "不限制", sub: "账号休息的时长不变" },
"zh-TW": { name: "告訴智慧體的最長等待", head: "回覆", min: (n) => `${n} 分鐘`, none: "不限制", sub: "帳號休息的時長不變" },
ja: { name: "エージェントに伝える最長の待ち時間", head: "応答", min: (n) => `${n} 分`, none: "上限なし", sub: "アカウントの休止時間は変わりません" },
de: { name: "Längste Wartezeit für einen Agenten", head: "Antworten", min: (n) => `${n} min`, none: "Kein Limit", sub: "Die Konten ruhen in beiden Fällen gleich lange" },
en: { name: "Longest wait an agent is told", head: "Routing", min: (n) => `${n} min`, none: "No limit", sub: "The accounts rest as long either way" },
zh: { name: "告诉智能体的最长等待", head: "路由", min: (n) => `${n} 分钟`, none: "不限制", sub: "账号休息的时长不变" },
"zh-TW": { name: "告訴智慧體的最長等待", head: "路由", min: (n) => `${n} 分鐘`, none: "不限制", sub: "帳號休息的時長不變" },
ja: { name: "エージェントに伝える最長の待ち時間", head: "ルーティング", min: (n) => `${n} 分`, none: "上限なし", sub: "アカウントの休止時間は変わりません" },
de: { name: "Längste Wartezeit für einen Agenten", head: "Weiterleitung", min: (n) => `${n} min`, none: "Kein Limit", sub: "Die Konten ruhen in beiden Fällen gleich lange" },
};
function serve(lang, saved) {
@@ -63,7 +63,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await watchSettingsReads(page);
await page.goto("http://magpie.test/?view=settings&tab=models");
await settingsDrawn(page); // rows found are the ones that stay (#1659)
const row = page.locator("#replyList #retryAfterCapRow");
const row = page.locator("#routeList #retryAfterCapRow");
await row.waitFor();
// scrolled to as a reader does, with the wheel: WebKit at 420 put
// back a scroll made from script
@@ -86,7 +86,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
});
assert(fit, `${part} fits at ${width}`);
}
assert.equal(await page.locator("#replyList").evaluate((l) => l.previousElementSibling.textContent.trim()), w.head);
assert.equal(await page.locator("#routeList").evaluate((l) => l.previousElementSibling.textContent.trim()), w.head);
const opts = row.locator(".segs button");
assert.deepEqual(await opts.allTextContents(), [w.min(1), w.min(5), w.min(15), w.none]);
const none = row.locator(".segs button", { hasText: w.none });
+29 -1
View File
@@ -2,7 +2,10 @@
// Settings' rows where their feature is (the scattered settings audit after
// netube99 on X): magpie web draws no empty Menu bar cost row, as it has no
// menu bar; the alerts (allowance, balance, reset, task done) sit under
// their own Alerts heading, not among the allowances' display. Every
// their own Alerts heading, not among the allowances' display; what routing
// does when an account refuses or every one rests, and a busy model's place
// (from Network), sit under Models › Routing, which the Routing page opens.
// Every
// language, Chromium and WebKit, at 1100 and 420 wide, nothing past the
// window's edge. No backend, the API is faked here.
const assert = require("node:assert/strict");
@@ -80,6 +83,31 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(await page.locator("#trayCostRow").isVisible(), false, "no Menu bar cost row in magpie web");
assert(await fits(page), "fits in magpie web");
assert.deepEqual(page.errors, []);
// Models › Routing: the rows about where a request goes, after the
// replies' own rows, and the busy model's place out of Network
page = await open(false, "settings&tab=models");
const rhead = page.locator("#routeList").locator("xpath=preceding-sibling::*[1]");
await rhead.waitFor();
assert.equal((await rhead.textContent()).trim(), await tr(page, "Routing"));
for (const id of ["refusalRetriesRow", "retryAfterCapRow", "classifyTimeoutRow", "busyLoadRow"]) {
assert.equal(await page.locator(`#routeList > #${id}`).count(), 1, id + " under Routing");
}
assert(await page.evaluate(() => document.querySelector("#replyList").compareDocumentPosition(document.querySelector("#routeList")) & Node.DOCUMENT_POSITION_FOLLOWING), "after the replies' rows");
assert.equal(await page.locator("#busyLoadRow").count(), 1, "one busy model row, not one in Network too");
assert(await page.locator("#busyLoadRow").isVisible(), "shown on the Models tab");
assert(await fits(page), "fits");
assert.deepEqual(page.errors, []);
// the Routing page leads there
page = await open(false, "routing");
const go = page.locator("#rtToSet");
await go.waitFor();
assert.equal((await go.textContent()).trim(), (await tr(page, "Settings")) + " ›");
assert(await fits(page), "the Routing page fits");
await go.click();
await page.locator("#view-settings #routeList .row.flash").waitFor();
assert.deepEqual(page.errors, []);
});
}
}
+1 -1
View File
@@ -606,7 +606,7 @@ magpie quota <span class="c"># acme · Pro · 5h 37%
<li><b>値。</b>100 はベンダーが同時に処理できる満杯の状態で、待ち行列のあるベンダーはそれを超えて報告できます(200 はその 2 倍)。0 未満は 0、10000 超は 10000 として扱います(異常値の上限)。それ以外(文字列、<code>NaN</code>)は捨てられます。モデル id は大文字小文字を区別せず、<code>model@256k</code> は個別に報告がなければ元のモデルの負荷になります。1 回の呼び出しで最大 1000 モデルまで受け取り、受け取った数を返します。provider が文字列でない、または <code>loads</code> がオブジェクトでないと <code>TypeError</code> を投げます。</li>
<li><b>鮮度。</b>各モデルの負荷は報告した呼び出しから 5 分間有効で、その後は不明になり、0 とはみなしません。報告をやめたプラグインのモデルは元の位置のままです。呼び出しで触れなかったモデルは、自分の 5 分が切れるまで前回の負荷を保ちます。</li>
<li><b>表示。</b>プロバイダーの編集画面で、モデルの横に小さな灰色の数字で出ます。</li>
<li><b>ルーティング。</b>設定 › ネットワークと共有 › 混雑しているモデルを後回しに でしきい値を選ぶと(既定はオフ。50、70、80、90% 超、または「カスタム…」で 1〜9999 の任意の数。待ち行列のあるベンダーなら 150 など)、それより混雑していると報告されたモデルは、リクエストが行ける他の候補の後ろ、失敗後に休んでいる候補の前に回ります。そのモデルが答えた会話は次のターンで先頭の候補に移り、ターンの途中では移りません。負荷が分からないモデルは元の位置のままです。ルーティングのトレースには <code>busy</code> と負荷が出ます。</li>
<li><b>ルーティング。</b>設定 › モデル › ルーティング › 混雑しているモデルを後回しに でしきい値を選ぶと(既定はオフ。50、70、80、90% 超、または「カスタム…」で 1〜9999 の任意の数。待ち行列のあるベンダーなら 150 など)、それより混雑していると報告されたモデルは、リクエストが行ける他の候補の後ろ、失敗後に休んでいる候補の前に回ります。そのモデルが答えた会話は次のターンで先頭の候補に移り、ターンの途中では移りません。負荷が分からないモデルは元の位置のままです。ルーティングのトレースには <code>busy</code> と負荷が出ます。</li>
</ul>
<p>古いホスト向けのプラグインは、上の例のように先に <code>input.magpie?.load</code> を確かめます。</p>
+1 -1
View File
@@ -606,7 +606,7 @@ magpie quota <span class="c"># acme · Pro · 5h 37%
<li><b>Values.</b> 100 is as busy as the vendor serves at once; a vendor that queues reports past it (200 is twice that). A number below 0 counts as 0, and one past 10000 as 10000, a sanity cap. Anything else (a string, <code>NaN</code>) is dropped. Model ids match whatever their case, and <code>model@256k</code> has its model’s load unless reported itself. One call takes up to 1000 models and returns how many it took. A provider that isn’t a string, or a <code>loads</code> that isn’t an object, throws a <code>TypeError</code>.</li>
<li><b>Freshness.</b> Each model’s load counts for five minutes from the call that reported it. After that it is unknown, never 0: a plugin that stops calling leaves its models where they were. A model a call doesn’t name keeps its last load until its own five minutes run out.</li>
<li><b>Where it shows.</b> The provider editor shows it by the model, a small grey number.</li>
<li><b>Routing.</b> With Settings › Network and sharing › Busy models last set (Off by default; over 50, 70, 80 or 90%, or Custom… for any number from 1 to 9999, such as 150 for a vendor that queues), a model reported busier than that goes behind every other candidate a request could go to, ahead of those resting after a failure. A conversation it answered moves to the one that leads at its next turn; within a turn it stays. A model with no load known keeps its place. The Routing trace says <code>busy</code> with the load.</li>
<li><b>Routing.</b> With Settings › Models › Routing › Busy models last set (Off by default; over 50, 70, 80 or 90%, or Custom… for any number from 1 to 9999, such as 150 for a vendor that queues), a model reported busier than that goes behind every other candidate a request could go to, ahead of those resting after a failure. A conversation it answered moves to the one that leads at its next turn; within a turn it stays. A model with no load known keeps its place. The Routing trace says <code>busy</code> with the load.</li>
</ul>
<p>A plugin written for older hosts checks <code>input.magpie?.load</code> first, as above.</p>
+1 -1
View File
@@ -606,7 +606,7 @@ magpie quota <span class="c"># acme · Pro · 5h 37%
<li><b>取值。</b>100 表示供应商同时能服务的满载;会排队的供应商可以报超过 100 的值(200 是满载的两倍)。小于 0 按 0 算,大于 10000 按 10000 算(防止离谱的值)。其他值(字符串、<code>NaN</code>)丢弃。模型 id 不区分大小写,<code>model@256k</code> 没单独报时用它所属模型的负载。一次最多 1000 个模型,返回收下的个数。provider 不是字符串,或 <code>loads</code> 不是对象,会抛出 <code>TypeError</code>。</li>
<li><b>时效。</b>每个模型的负载从报告它的那次调用起算五分钟有效,之后就是未知,绝不当作 0:插件不再报告时,它的模型保持原位。一次调用没提到的模型,保留上次的负载,直到它自己的五分钟到期。</li>
<li><b>在哪显示。</b>供应商编辑页里模型旁边的灰色小数字。</li>
<li><b>路由。</b>在 设置 › 网络与共享 › 繁忙的模型靠后 选了阈值(默认关闭;可选高于 50、70、80 或 90%,或选“自定义…”输入 1 到 9999 之间的任意数,比如会排队的供应商可设 150)后,报告负载高于它的模型会排到请求能去的其他候选之后,但仍在失败后休息的候选之前。它答过的对话在下一轮换到排在最前的那个;同一轮之内不换。没有已知负载的模型保持原位。路由追踪里显示 <code>busy</code> 和负载值。</li>
<li><b>路由。</b>在 设置 › 模型 › 路由 › 繁忙的模型靠后 选了阈值(默认关闭;可选高于 50、70、80 或 90%,或选“自定义…”输入 1 到 9999 之间的任意数,比如会排队的供应商可设 150)后,报告负载高于它的模型会排到请求能去的其他候选之后,但仍在失败后休息的候选之前。它答过的对话在下一轮换到排在最前的那个;同一轮之内不换。没有已知负载的模型保持原位。路由追踪里显示 <code>busy</code> 和负载值。</li>
</ul>
<p>为旧版宿主写的插件先检查 <code>input.magpie?.load</code>,如上例。</p>