fix: align ZAI thinking toggles

This commit is contained in:
Peter Steinberger
2026-01-16 22:25:51 +00:00
parent 3567dc4a47
commit 500c75b4f0
14 changed files with 134 additions and 562 deletions

View File

@@ -1,5 +1,10 @@
import { describe, expect, it } from "vitest";
import { listThinkingLevels, normalizeReasoningLevel, normalizeThinkLevel } from "./thinking.js";
import {
listThinkingLevelLabels,
listThinkingLevels,
normalizeReasoningLevel,
normalizeThinkLevel,
} from "./thinking.js";
describe("normalizeThinkLevel", () => {
it("accepts mid as medium", () => {
@@ -9,6 +14,10 @@ describe("normalizeThinkLevel", () => {
it("accepts xhigh", () => {
expect(normalizeThinkLevel("xhigh")).toBe("xhigh");
});
it("accepts on as low", () => {
expect(normalizeThinkLevel("on")).toBe("low");
});
});
describe("listThinkingLevels", () => {
@@ -25,6 +34,17 @@ describe("listThinkingLevels", () => {
});
});
describe("listThinkingLevelLabels", () => {
it("returns on/off for ZAI", () => {
expect(listThinkingLevelLabels("zai", "glm-4.7")).toEqual(["off", "on"]);
});
it("returns full levels for non-ZAI", () => {
expect(listThinkingLevelLabels("openai", "gpt-4.1-mini")).toContain("low");
expect(listThinkingLevelLabels("openai", "gpt-4.1-mini")).not.toContain("on");
});
});
describe("normalizeReasoningLevel", () => {
it("accepts on/off", () => {
expect(normalizeReasoningLevel("on")).toBe("on");