gateway: a relay check asks harder fixed-answer questions too (skingstyle48487 on X)

skingstyle48487 found the check's first questions too easy to tell
relays apart: a cut-down model gets three products and a tool call right
as often as the real one. The check now also asks five short questions
such a model tends to miss, each with one answer a program can check:
- two sums in a few steps: (37 × 43 + 1289) × 7 − 2468 and
  17 × 17 × 17 − 29 × 31;
- how many r's are in "strawberry raspberry", as a number;
- the first five primes past 50, as "53,59,61,67,71";
- five words sorted, in lower case and joined by hyphens.
Numbers are read past separators as before. The two exact-form answers
are compared as written: only quotes, a code mark or a full stop around
them are read past, so case and spacing count. That makes 11 calls, still
three at a time. No prompt names a product, a vendor or a limit, and
TestRelayPromptsNameNoOne holds that. The dialog names each new item in
the five languages ("Work out (37 × 43 + 1289) × 7 − 2468", "Sort five
words"), and its intro names the new kinds.

Run (mote):
- go test -run 'CheckRelay|RelayPrompts|ReadChatStream' -v
  ./internal/gateway: 7 pass;
- usage-model-speed.test.cjs, chromium and webkit, five languages:
  12/12;
- i18n-keys: 4/4.
Broken by hand:
- the exact answers read as numbers turns TestCheckRelayAnsweredAsAsked
  and TestCheckRelayCountsEachAnswer red;
- the exact answers compared without case turns
  TestCheckRelayHarderAnswersApart red ("Apple-banana-…" read as right).
Not tried: a real relay or a real cut-down model; how often each item
splits real relays is not measured.
This commit is contained in:
yetone
2026-11-18 05:27:43 +08:00
parent 495ada49a7
commit 73a70275ce
5 changed files with 153 additions and 33 deletions
+42 -11
View File
@@ -34,6 +34,8 @@ import (
const (
RelayPartCount = "count" // write 1 to 40: the reply, its speed, its tokens
RelayPartMath = "math" // a multiplication with a known product
RelayPartSteps = "steps" // a sum in a few steps, with a known result
RelayPartExact = "exact" // an answer asked for in an exact form
RelayPartTool = "tool" // a question one of two tools answers
)
@@ -94,9 +96,33 @@ func tapUsage(r *http.Request, rec usage.Record) {
// to be measured, short enough to cost a few hundred tokens.
const relayCountTo = 40
// relayMaths are the multiplications the math calls ask, and their
// products: four-digit numbers, past what a model answers from memory.
var relayMaths = [][2]string{{"1234 * 5678", "7006652"}, {"987 * 654", "645498"}, {"2468 * 1357", "3349076"}}
// checkAsk is a call with one right answer: ask is what the GUI names it
// by (the sum, or an exact item's id), text that the answer is compared
// as written rather than as a number.
type checkAsk struct {
kind, ask, prompt, want string
text bool
}
const checkNumOnly = " Answer with the number only, without separators."
// checkAsks are the fixed-answer calls. The products are four-digit
// numbers, past what a model answers from memory. The harder ones
// (skingstyle48487's second follow-up: the first set told relays apart
// too seldom) are what a smaller or cut-down model tends to miss: a sum
// in a few steps, letters counted across two words, primes listed in an
// exact form, words sorted and joined as told. Each is short and has one
// answer a program can check; none names a product or a vendor.
var checkAsks = []checkAsk{
{kind: RelayPartMath, ask: "1234 × 5678", prompt: "What is 1234 * 5678?" + checkNumOnly, want: "7006652"},
{kind: RelayPartMath, ask: "987 × 654", prompt: "What is 987 * 654?" + checkNumOnly, want: "645498"},
{kind: RelayPartMath, ask: "2468 × 1357", prompt: "What is 2468 * 1357?" + checkNumOnly, want: "3349076"},
{kind: RelayPartSteps, ask: "(37 × 43 + 1289) × 7 − 2468", prompt: "What is (37 * 43 + 1289) * 7 - 2468?" + checkNumOnly, want: "17692"},
{kind: RelayPartSteps, ask: "17 × 17 × 17 − 29 × 31", prompt: "What is 17 * 17 * 17 - 29 * 31?" + checkNumOnly, want: "4014"},
{kind: RelayPartExact, ask: "letters", prompt: "How many times does the letter r appear in the words strawberry raspberry?" + checkNumOnly, want: "6"},
{kind: RelayPartExact, ask: "primes", prompt: "List the first five prime numbers greater than 50, separated by commas without spaces, and nothing else.", want: "53,59,61,67,71", text: true},
{kind: RelayPartExact, ask: "sort", prompt: "Sort these words alphabetically, write them in lower case joined by single hyphens, and nothing else: pear, Apple, fig, banana, cherry", want: "apple-banana-cherry-fig-pear", text: true},
}
// relayTools are the tool calls' questions, the tool each should call and
// the word its arguments should hold. Both calls offer both tools, so the
@@ -106,7 +132,8 @@ var relayTools = []struct{ q, tool, arg string }{
{"What time is it in Tokyo now? Use a tool.", "get_time", "tokyo"},
}
// CheckRelay checks model on providerID with its calls, three at a time. A provider or model the gateway can't resolve is each call's
// CheckRelay checks model on providerID with its calls, three at a time.
// A provider or model the gateway can't resolve is each call's
// error, as an agent would meet it.
func (s *Server) CheckRelay(ctx context.Context, providerID, model string) RelayCheckResult {
out := RelayCheckResult{Provider: providerID, Model: model}
@@ -118,11 +145,11 @@ func (s *Server) CheckRelay(ctx context.Context, providerID, model string) Relay
count := "Write the whole numbers from 1 to " + strconv.Itoa(relayCountTo) + " in order, separated by single spaces, and nothing else."
type call struct {
kind, ask, prompt, want, arg string
tools bool
tools, text bool
}
calls := []call{{kind: RelayPartCount, prompt: count, want: strings.Join(nums, " ")}}
for _, m := range relayMaths {
calls = append(calls, call{kind: RelayPartMath, ask: strings.ReplaceAll(m[0], "*", "×"), prompt: "What is " + m[0] + "? Answer with the number only, without separators.", want: m[1]})
for _, a := range checkAsks {
calls = append(calls, call{kind: a.kind, ask: a.ask, prompt: a.prompt, want: a.want, text: a.text})
}
for _, x := range relayTools {
calls = append(calls, call{kind: RelayPartTool, ask: x.tool, prompt: x.q, want: x.tool, arg: x.arg, tools: true})
@@ -140,12 +167,16 @@ func (s *Server) CheckRelay(ctx context.Context, providerID, model string) Relay
defer func() { <-slots }()
p := s.relayCall(ctx, ref, c.prompt, c.tools)
p.Kind, p.Ask, p.Want = c.kind, c.ask, c.want
switch c.kind {
case RelayPartCount:
switch {
case c.kind == RelayPartCount:
p.Match = p.OK && strings.Join(strings.Fields(p.Got), " ") == c.want
case RelayPartMath:
case c.text:
// as written: only quotes, a code mark or a full stop
// around it are read past
p.Match = p.OK && strings.Trim(p.Got, " \n.`\"'") == c.want
case c.kind != RelayPartTool:
p.Match = p.OK && strings.Trim(strings.NewReplacer(",", "", " ", "", " ", "").Replace(p.Got), ".`*\n") == c.want
case RelayPartTool:
default:
p.Match = p.OK && strings.HasPrefix(p.Got, c.want+"(") && strings.Contains(strings.ToLower(p.Got), c.arg)
}
if c.kind == RelayPartCount {
+67 -6
View File
@@ -74,7 +74,7 @@ func relayParts(c RelayCheckResult) map[string]RelayPart {
return m
}
// relayRight answers each part as asked: the count, every product, and
// relayRight answers each part as asked: the count, every fixed answer, and
// the tool each question needs.
func relayRight(prompt string, tools bool) (string, string) {
switch {
@@ -83,9 +83,9 @@ func relayRight(prompt string, tools bool) (string, string) {
case strings.Contains(prompt, "Tokyo"):
return "", `get_time{"city":"Tokyo"}`
}
for _, m := range relayMaths {
if strings.Contains(prompt, m[0]) {
return m[1], ""
for _, a := range checkAsks {
if prompt == a.prompt {
return a.want, ""
}
}
var n []string
@@ -106,7 +106,7 @@ func TestCheckRelayAnsweredAsAsked(t *testing.T) {
return relayRight(prompt, tools)
})
c := New().CheckRelay(context.Background(), "relay", "gpt-5.5")
n := 1 + len(relayMaths) + len(relayTools)
n := 1 + len(checkAsks) + len(relayTools)
if c.Provider != "relay" || c.Model != "gpt-5.5" || len(c.Parts) != n || int(calls.Load()) != n {
t.Fatalf("%+v, %d calls", c, calls.Load())
}
@@ -128,6 +128,67 @@ func TestCheckRelayAnsweredAsAsked(t *testing.T) {
if p := ps["tool get_time"]; p.Got != `get_time({"city":"Tokyo"})` {
t.Fatalf("tool: %+v", p)
}
if p := ps["exact sort"]; p.Got != "apple-banana-cherry-fig-pear" {
t.Fatalf("sort: %+v", p)
}
}
// The harder ones are told apart from the easy ones: a model right on
// every product but a step out in a longer sum, a letter short, primes
// spaced and words not lowered has exactly those not as asked. A code
// mark or full stop around a number is read past.
func TestCheckRelayHarderAnswersApart(t *testing.T) {
fresh(t)
checkedRelayUp(t, "gpt-5.5", 31, func(prompt string, tools bool) (string, string) {
switch {
case strings.Contains(prompt, "- 2468?"):
return "17682", ""
case strings.Contains(prompt, "strawberry"):
return "5", ""
case strings.Contains(prompt, "prime"):
return "53, 59, 61, 67, 71", ""
case strings.Contains(prompt, "Sort"):
return "Apple-banana-cherry-fig-pear", ""
case strings.Contains(prompt, "17 * 17"):
return "`4014`.", ""
}
return relayRight(prompt, tools)
})
ps := relayParts(New().CheckRelay(context.Background(), "relay", "gpt-5.5"))
var off []string
for k, p := range ps {
if !p.OK {
t.Fatalf("%s: %+v", k, p)
}
if !p.Match {
off = append(off, k)
}
}
slices.Sort(off)
if strings.Join(off, ",") != "exact letters,exact primes,exact sort,steps (37 × 43 + 1289) × 7 − 2468" {
t.Fatalf("not as asked: %v", off)
}
}
// What a check asks goes to the provider as written, so it names no
// product, vendor or limit: a relay sees an ordinary short question.
func TestRelayPromptsNameNoOne(t *testing.T) {
var ps []string
for _, a := range checkAsks {
ps = append(ps, a.prompt)
}
for _, x := range relayTools {
ps = append(ps, x.q)
}
ps = append(ps, string(relayCheckTools))
for _, p := range ps {
l := strings.ToLower(p)
for _, w := range []string{"magpie", "openai", "anthropic", "claude", "gpt", "gemini", "qwen", "relay", "limit", "test", "check"} {
if strings.Contains(l, w) {
t.Errorf("%q names %q", p, w)
}
}
}
}
// A model that calls the wrong one of the two tools, or answers one
@@ -138,7 +199,7 @@ func TestCheckRelayCountsEachAnswer(t *testing.T) {
switch {
case strings.Contains(prompt, "Tokyo"):
return "", `get_weather{"city":"Tokyo"}`
case strings.Contains(prompt, "2468"):
case strings.Contains(prompt, "2468 *"):
return "3349176", ""
}
return relayRight(prompt, tools)
+20 -4
View File
@@ -5,10 +5,14 @@
const I18N = {
zh: {
"Check {model} on {provider}": "在 {provider} 上检查 {model}",
"A few small real calls with known answers, billed as any other: write the numbers 1 to 40, multiply, call the right tool. Each says what came back.": "几次小的真实调用,答案事先已知,照常计费:写出 1 到 40、算乘法、调用正确的工具。每一项都列出实际返回的内容。",
"A few small real calls with known answers, billed as any other: write the numbers 1 to 40, work out sums, answer in an exact form, call the right tool. Each says what came back.": "几次小的真实调用,答案事先已知,照常计费:写出 1 到 40、算算术、按指定格式作答、调用正确的工具。每一项都列出实际返回的内容。",
"Count to 40": "数到 40",
"Multiply {q}": "计算 {q}",
"Call {tool}": "调用 {tool}",
"Work out {q}": "计算 {q}",
"Count the r's in strawberry raspberry": "数 strawberry raspberry 里的 r",
"List five primes after 50": "列出 50 之后的五个质数",
"Sort five words": "给五个词排序",
"Expected answer": "符合预期",
"Unexpected answer": "不符合预期",
"Answered in text, without calling a tool": "用文字回答,没有调用工具",
@@ -5459,10 +5463,14 @@ const I18N = {
},
"zh-TW": {
"Check {model} on {provider}": "在 {provider} 上檢查 {model}",
"A few small real calls with known answers, billed as any other: write the numbers 1 to 40, multiply, call the right tool. Each says what came back.": "幾次小的真實呼叫,答案事先已知,照常計費:寫出 1 到 40、算乘法、呼叫正確的工具。每一項都列出實際回傳的內容。",
"A few small real calls with known answers, billed as any other: write the numbers 1 to 40, work out sums, answer in an exact form, call the right tool. Each says what came back.": "幾次小的真實呼叫,答案事先已知,照常計費:寫出 1 到 40、算算術、按指定格式作答、呼叫正確的工具。每一項都列出實際回傳的內容。",
"Count to 40": "數到 40",
"Multiply {q}": "計算 {q}",
"Call {tool}": "呼叫 {tool}",
"Work out {q}": "計算 {q}",
"Count the r's in strawberry raspberry": "數 strawberry raspberry 裡的 r",
"List five primes after 50": "列出 50 之後的五個質數",
"Sort five words": "為五個詞排序",
"Expected answer": "符合預期",
"Unexpected answer": "不符合預期",
"Answered in text, without calling a tool": "用文字回答,沒有呼叫工具",
@@ -10897,10 +10905,14 @@ const I18N = {
},
ja: {
"Check {model} on {provider}": "{provider} で {model} をチェック",
"A few small real calls with known answers, billed as any other: write the numbers 1 to 40, multiply, call the right tool. Each says what came back.": "答えの決まった小さな実際の呼び出しを数回行います(通常どおり課金):1 から 40 までを書く、掛け算、正しいツールを呼ぶ。それぞれ返ってきた内容を示します。",
"A few small real calls with known answers, billed as any other: write the numbers 1 to 40, work out sums, answer in an exact form, call the right tool. Each says what came back.": "答えの決まった小さな実際の呼び出しを数回行います(通常どおり課金):1 から 40 までを書く、計算する、決まった形式で答える、正しいツールを呼ぶ。それぞれ返ってきた内容を示します。",
"Count to 40": "40 まで数える",
"Multiply {q}": "{q} を計算",
"Call {tool}": "{tool} を呼ぶ",
"Work out {q}": "{q} を計算",
"Count the r's in strawberry raspberry": "strawberry raspberry の r を数える",
"List five primes after 50": "50 より大きい素数を5つ挙げる",
"Sort five words": "5つの単語を並べ替える",
"Expected answer": "想定どおり",
"Unexpected answer": "想定と異なる",
"Answered in text, without calling a tool": "ツールを呼ばずにテキストで答えた",
@@ -16337,10 +16349,14 @@ const I18N = {
},
de: {
"Check {model} on {provider}": "{model} bei {provider} prüfen",
"A few small real calls with known answers, billed as any other: write the numbers 1 to 40, multiply, call the right tool. Each says what came back.": "Ein paar kleine echte Aufrufe mit bekannten Antworten, wie jeder andere berechnet: die Zahlen 1 bis 40 schreiben, multiplizieren, das richtige Werkzeug aufrufen. Jeder zeigt, was zurückkam.",
"A few small real calls with known answers, billed as any other: write the numbers 1 to 40, work out sums, answer in an exact form, call the right tool. Each says what came back.": "Ein paar kleine echte Aufrufe mit bekannten Antworten, wie jeder andere berechnet: die Zahlen 1 bis 40 schreiben, rechnen, in einer genauen Form antworten, das richtige Werkzeug aufrufen. Jeder zeigt, was zurückkam.",
"Count to 40": "Bis 40 zählen",
"Multiply {q}": "{q} rechnen",
"Call {tool}": "{tool} aufrufen",
"Work out {q}": "{q} ausrechnen",
"Count the r's in strawberry raspberry": "Die r in strawberry raspberry zählen",
"List five primes after 50": "Fünf Primzahlen nach 50 nennen",
"Sort five words": "Fünf Wörter sortieren",
"Expected answer": "Wie erwartet",
"Unexpected answer": "Nicht wie erwartet",
"Answered in text, without calling a tool": "Als Text beantwortet, ohne ein Werkzeug aufzurufen",
+10 -4
View File
@@ -2,9 +2,10 @@
// with more than ten relays): one model on one provider checked with a
// few small real calls through the gateway (/api/relay-check), each with
// an answer known in advance: count to 40, three multiplications, two
// questions a tool answers. What each found is said as found, a number or
// what came back, never a verdict on the provider: a model can miss a sum
// on one call, and a provider can count tokens its own way. The right
// longer sums, three answers in an exact form, two questions a tool
// answers. What each found is said as found, a number or what came
// back, never a verdict on the provider: a model can miss a sum on one
// call, and a provider can count tokens its own way. The right
// answers are counted and kept (relayKeep), so the card sets each
// provider's last check beside the others'. The calls cost what they
// cost, so only the dialog's Check sends them. plugins/usage/page.js
@@ -17,7 +18,7 @@ window.relayCheck = function (provider, model, providerName, modelName) {
const ed = el("div", "editor relay-check");
const head = el("div", "ehead");
head.append(el("b", "", t("Check {model} on {provider}", { model: modelName, provider: providerName })));
const say = el("p", "lib-confirm", t("A few small real calls with known answers, billed as any other: write the numbers 1 to 40, multiply, call the right tool. Each says what came back."));
const say = el("p", "lib-confirm", t("A few small real calls with known answers, billed as any other: write the numbers 1 to 40, work out sums, answer in an exact form, call the right tool. Each says what came back."));
const list = el("div", "relay-parts");
list.setAttribute("role", "status");
list.hidden = true;
@@ -72,9 +73,14 @@ function relayKeep(provider, model, r) {
window.dispatchEvent(new CustomEvent("magpie-relay-checked"));
}
// the exact items by the id the gateway gives them
const RELAY_EXACT = { letters: "Count the r's in strawberry raspberry", primes: "List five primes after 50", sort: "Sort five words" };
function relayName(p) {
if (p.kind === "count") return t("Count to 40");
if (p.kind === "math") return t("Multiply {q}", { q: p.ask });
if (p.kind === "steps") return t("Work out {q}", { q: p.ask });
if (p.kind === "exact") return RELAY_EXACT[p.ask] ? t(RELAY_EXACT[p.ask]) : p.ask;
return t("Call {tool}", { tool: p.ask });
}
+14 -8
View File
@@ -46,6 +46,8 @@ const CHECK = {
{ kind: "math", ask: "987 × 654", ok: true, match: true, want: "645498", got: "645498", ms: 700, ttft_ms: 400, input: 30, output: 5, tries: 1 },
{ kind: "tool", ask: "get_weather", ok: false, match: false, want: "get_weather", status: 403, error: "this key has no access to tools", ms: 80, tries: 1 },
{ kind: "tool", ask: "get_time", ok: true, match: true, want: "get_time", got: 'get_time({"city":"Tokyo"})', ms: 800, ttft_ms: 600, input: 90, output: 12, tries: 1 },
{ kind: "steps", ask: "(37 × 43 + 1289) × 7 − 2468", ok: true, match: false, want: "17692", got: "17682", ms: 900, ttft_ms: 500, input: 40, output: 5, tries: 1 },
{ kind: "exact", ask: "sort", ok: true, match: true, want: "apple-banana-cherry-fig-pear", got: "apple-banana-cherry-fig-pear", ms: 700, ttft_ms: 400, input: 50, output: 9, tries: 1 },
],
};
let checks = 0;
@@ -99,11 +101,11 @@ function server(lang) {
const L = {
en: { title: "Model speed", heads: ["Model", "Speed", "First token", "Requests"], fast: "75 tok/s", slow: "10 tok/s", wait: "600 ms", by: ["Models", "Providers"], more: ["Failed", "Other model"], check: "Check…", run: "Check", asked: "Expected answer", tokens: "4,200", sum: ["Answers right: 2 of 3", "Right tool calls: 1 of 2"], checked: ["Answers", "Tool calls"] },
zh: { title: "模型速度", heads: ["模型", "速度", "首字耗时", "请求"], fast: "75 token/秒", slow: "10 token/秒", wait: "600 毫秒", by: ["模型", "供应商"], more: ["失败", "其他模型"], check: "检查…", run: "检查", asked: "符合预期", tokens: "4,200", sum: ["答对 2 / 3", "工具调用正确 1 / 2"], checked: ["答对", "工具调用"] },
"zh-TW": { title: "模型速度", heads: ["模型", "速度", "首字耗時", "請求"], fast: "75 token/秒", slow: "10 token/秒", wait: "600 毫秒", by: ["模型", "供應商"], more: ["失敗", "其他模型"], check: "檢查…", run: "檢查", asked: "符合預期", tokens: "4,200", sum: ["答對 2 / 3", "工具呼叫正確 1 / 2"], checked: ["答對", "工具呼叫"] },
ja: { title: "モデルの速度", heads: ["モデル", "速度", "最初のトークン", "リクエスト"], fast: "75", slow: "10", wait: "600", by: ["モデル", "プロバイダ"], more: ["失敗", "別のモデル"], check: "チェック…", run: "チェック", asked: "想定どおり", tokens: "4,200", sum: ["正解 2 / 3", "正しいツール呼び出し 1 / 2"], checked: ["正解", "ツール呼び出し"] },
de: { title: "Modelltempo", heads: ["Modell", "Tempo", "Erstes Token", "Anfragen"], fast: "75", slow: "10", wait: "600", by: ["Modelle", "Anbieter"], more: ["Fehlgeschlagen", "Anderes Modell"], check: "Prüfen…", run: "Prüfen", asked: "Wie erwartet", tokens: "4.200", sum: ["Richtige Antworten: 2 von 3", "Richtige Werkzeugaufrufe: 1 von 2"], checked: ["Richtig", "Tool-Aufrufe"] },
en: { title: "Model speed", heads: ["Model", "Speed", "First token", "Requests"], fast: "75 tok/s", slow: "10 tok/s", wait: "600 ms", by: ["Models", "Providers"], more: ["Failed", "Other model"], check: "Check…", run: "Check", asked: "Expected answer", tokens: "4,200", sum: ["Answers right: 3 of 5", "Right tool calls: 1 of 2"], checked: ["Answers", "Tool calls"], sort: "Sort five words" },
zh: { title: "模型速度", heads: ["模型", "速度", "首字耗时", "请求"], fast: "75 token/秒", slow: "10 token/秒", wait: "600 毫秒", by: ["模型", "供应商"], more: ["失败", "其他模型"], check: "检查…", run: "检查", asked: "符合预期", tokens: "4,200", sum: ["答对 3 / 5", "工具调用正确 1 / 2"], checked: ["答对", "工具调用"], sort: "给五个词排序" },
"zh-TW": { title: "模型速度", heads: ["模型", "速度", "首字耗時", "請求"], fast: "75 token/秒", slow: "10 token/秒", wait: "600 毫秒", by: ["模型", "供應商"], more: ["失敗", "其他模型"], check: "檢查…", run: "檢查", asked: "符合預期", tokens: "4,200", sum: ["答對 3 / 5", "工具呼叫正確 1 / 2"], checked: ["答對", "工具呼叫"], sort: "為五個詞排序" },
ja: { title: "モデルの速度", heads: ["モデル", "速度", "最初のトークン", "リクエスト"], fast: "75", slow: "10", wait: "600", by: ["モデル", "プロバイダ"], more: ["失敗", "別のモデル"], check: "チェック…", run: "チェック", asked: "想定どおり", tokens: "4,200", sum: ["正解 3 / 5", "正しいツール呼び出し 1 / 2"], checked: ["正解", "ツール呼び出し"], sort: "5つの単語を並べ替える" },
de: { title: "Modelltempo", heads: ["Modell", "Tempo", "Erstes Token", "Anfragen"], fast: "75", slow: "10", wait: "600", by: ["Modelle", "Anbieter"], more: ["Fehlgeschlagen", "Anderes Modell"], check: "Prüfen…", run: "Prüfen", asked: "Wie erwartet", tokens: "4.200", sum: ["Richtige Antworten: 3 von 5", "Richtige Werkzeugaufrufe: 1 von 2"], checked: ["Richtig", "Tool-Aufrufe"], sort: "Fünf Wörter sortieren" },
};
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
@@ -217,15 +219,19 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await p.waitForTimeout(150);
assert.equal(checks, 0, "opening the dialog sends no call");
await dlg.locator(".bar button.primary").click();
await dlg.locator(".relay-part").nth(4).waitFor();
await dlg.locator(".relay-part").nth(6).waitFor();
assert.equal(checks, 1);
const parts = dlg.locator(".relay-part");
// the right answers counted apart from the right tool calls
assert.deepEqual((await dlg.locator(".relay-sum span").allTextContents()).map((x) => x.trim()), w.sum);
assert.equal((await parts.nth(0).locator(".relay-said").textContent()).trim(), w.asked);
assert.deepEqual(await dlg.locator(".relay-mark").evaluateAll((ms) => ms.map((m) => m.className.replace("relay-mark ", ""))), ["ok", "off", "ok", "err", "ok"]);
assert.deepEqual(await dlg.locator(".relay-mark").evaluateAll((ms) => ms.map((m) => m.className.replace("relay-mark ", ""))), ["ok", "off", "ok", "err", "ok", "off", "ok"]);
assert((await parts.nth(1).locator(".relay-name").textContent()).includes("1234 × 5678"));
assert((await parts.nth(4).locator(".relay-name").textContent()).includes("get_time"));
// the harder ones by name: a longer sum, and an exact item by its id
assert((await parts.nth(5).locator(".relay-name").textContent()).includes("(37 × 43 + 1289) × 7 − 2468"));
assert((await parts.nth(5).locator(".relay-line.mono").textContent()).includes("17682"));
assert.equal((await parts.nth(6).locator(".relay-name").textContent()).trim(), w.sort);
assert.equal(await parts.nth(2).locator(".relay-line").count(), 0, "an answer as asked says nothing more");
const count = await parts.nth(0).locator(".relay-line").allTextContents();
assert(count.some((x) => x.includes("118") && x.includes(w.tokens)), "the prompt's count: " + count);
@@ -242,7 +248,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const checkedHeads = async () => (await card.locator("thead th").allTextContents()).map((x) => x.replace(/[↑↓]/g, "").trim());
assert.deepEqual(await checkedHeads(), [...w.heads, ...w.more, ...w.checked, ""]);
const cells = (i) => card.locator("tbody tr").nth(i).locator("td").allTextContents();
assert.deepEqual((await cells(1)).slice(6, 8).map((x) => x.trim()), ["2/3", "1/2"]);
assert.deepEqual((await cells(1)).slice(6, 8).map((x) => x.trim()), ["3/5", "1/2"]);
assert.deepEqual((await cells(0)).slice(6, 8).map((x) => x.trim()), ["—", "—"]);
// the checked one first by Answers, the ones not checked last
await head(6).click();