Files
DeepTutor/web/tests/reasoning-effort.test.ts
Bingxi Zhao (Frank) 23ad80d1bf release: v1.5.12
Web search was rebuilt onto a single spec table and six providers were
added on it — Doubao, Bocha, Zhipu, Firecrawl, Baidu Qianfan, and Aliyun
IQS. Consolidating seven copies of the provider list is what surfaced
three silent defects: Serper's `num` never reached the API, Serper
dropped its proxies, and Jina had no result-count limit. A runtime search
failure now walks the account's other credentialed profiles and finally
DuckDuckGo instead of failing the turn, recording the downgrade under a
top-level `search_fallback` key; a *missing* key still fails loudly for
the six new providers, five of which are China-hosted and cannot reach
the fallback anyway.

Also here, by way of main: LiteParse as a sixth document-parsing engine,
and MCP servers that reconnect when a stored credential is rotated and
report a dead transport as itself rather than as a tool timeout. Plus
CodeBuddy and OrcaRouter model providers, a persisted Codex
reasoning-effort override, and vision on OpenAI Codex.

Notes: assets/releases/ver1-5-12.md

This commit also carries the README prose sync, the ten translated
READMEs (which gain the Open Source Partners section they were missing),
the release-notes archive sweep, and the version bump.
2026-08-13 18:49:48 +08:00

138 lines
3.6 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import {
reasoningEffortOptions,
reasoningEffortOptionsFromSupportedLevels,
setModelReasoningEffort,
} from "../lib/reasoning-effort";
const values = (binding: string, model: string, current = ""): string[] =>
reasoningEffortOptions(binding, model, current).map((option) => option.value);
test("Gemini 3 and 2.5 Pro do not list the invalid none effort", () => {
assert.deepEqual(values("gemini", "gemini-3.6-flash"), [
"",
"minimal",
"low",
"medium",
"high",
]);
assert.equal(values("gemini", "gemini-2.5-pro").includes("none"), false);
});
test("a stored value this table excludes stays visible so it can be reset", () => {
// The recovery path for a profile already sending a rejected value: it has
// to be selectable to be switched back to Auto.
assert.deepEqual(values("gemini", "gemini-3.6-flash", "none"), [
"",
"minimal",
"low",
"medium",
"high",
"none",
]);
});
test("provider aliases resolve to the canonical adapter", () => {
assert.deepEqual(values("google", "gemini-2.5-flash"), [
"",
"none",
"low",
"medium",
"high",
]);
assert.deepEqual(values("azure", "gpt-5.2"), [
"",
"minimal",
"low",
"medium",
"high",
"xhigh",
]);
assert.deepEqual(values("claude", "claude-opus-5"), ["", "none", "adaptive"]);
});
test("effort-based Claude families offer adaptive, older ones do not", () => {
// Opus 4.7+ reject enabled+budget_tokens and every real level collapses to
// adaptive; the older families 400 on adaptive instead.
for (const model of ["claude-opus-4-7", "claude-opus-5", "claude-fable-5"]) {
assert.deepEqual(values("anthropic", model), ["", "none", "adaptive"]);
}
assert.equal(
values("anthropic", "claude-opus-4-6").includes("adaptive"),
false,
);
});
test("Gemini 2.5 Flash can explicitly disable reasoning", () => {
assert.deepEqual(values("gemini", "gemini-2.5-flash"), [
"",
"none",
"low",
"medium",
"high",
]);
});
test("known reasoning families get conservative provider-specific choices", () => {
assert.deepEqual(values("openai", "gpt-5.2"), [
"",
"minimal",
"low",
"medium",
"high",
"xhigh",
]);
assert.deepEqual(values("anthropic", "claude-sonnet-4-5"), [
"",
"none",
"low",
"medium",
"high",
]);
assert.deepEqual(values("dashscope", "qwen3-max"), ["", "minimal", "high"]);
assert.deepEqual(values("custom", "deepseek-reasoner"), [
"",
"minimal",
"high",
]);
});
test("unknown models stay hidden unless they already carry an override", () => {
assert.deepEqual(values("openai", "gpt-4o"), []);
assert.deepEqual(values("unknown", "model", "vendor-level"), [
"",
"vendor-level",
]);
});
test("managed profiles use only the provider-supported reasoning levels", () => {
assert.deepEqual(
reasoningEffortOptionsFromSupportedLevels(["medium", "high"]).map(
(option) => option.value,
),
["", "medium", "high"],
);
assert.deepEqual(
reasoningEffortOptionsFromSupportedLevels([
"high",
"",
"high",
"medium",
]).map((option) => option.value),
["", "high", "medium"],
);
});
test("Auto removes the catalog field instead of persisting an empty string", () => {
const model: { reasoning_effort?: string } = {
reasoning_effort: "high",
};
setModelReasoningEffort(model, "");
assert.equal("reasoning_effort" in model, false);
setModelReasoningEffort(model, " medium ");
assert.equal(model.reasoning_effort, "medium");
});