Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

feat(web): drop redundant Medium from GLM 5.3 reasoning selector

Diego Moraes013342cf2e21
diff --git a/web/src/App.tsx b/web/src/App.tsx
index 55374556..283ae1dd 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -39,6 +39,7 @@ import { persistPublicSettings, stored } from "@/lib/storage"
import { Markdown } from "@/components/Markdown"
import { cn } from "@/lib/utils"
import { useLocale } from "./i18n"
+import { REASONING_EFFORT, modelForcesReasoning, reasoningLevelsFor, type ReasoningLevel } from "@/lib/reasoning"
const message = (role: ChatMessage["role"], content: string): ChatMessage => {
let id: string
@@ -46,24 +47,6 @@ const message = (role: ChatMessage["role"], content: string): ChatMessage => {
return { id, role, content }
}
-/* Reasoning depth for GLM. The engine renders enable_thinking + reasoning_effort;
- these levels map onto the words GLM understands (Low/Medium/High/Max), and "off"
- turns thinking off entirely. GLM 5.3 cannot disable reasoning, so "off" is dropped
- for it -- the model's own constraint, mirrored in the control rather than sent and
- silently ignored. */
-type ReasoningLevel = "off" | "low" | "medium" | "high" | "max"
-
-const REASONING_EFFORT: Record<Exclude<ReasoningLevel, "off">, string> = {
- low: "low", medium: "medium", high: "high", max: "xhigh",
-}
-
-const modelForcesReasoning = (model: string) => /5\.3/.test(model)
-
-const reasoningLevelsFor = (model: string): ReasoningLevel[] =>
- modelForcesReasoning(model)
- ? ["low", "medium", "high", "max"]
- : ["off", "low", "medium", "high", "max"]
-
export default function App() {
const { t, locale, setLocale, locales } = useLocale()
@@ -178,11 +161,13 @@ export default function App() {
// EFFECT #6
useEffect(() => { setLastRun(null) }, [cacheSlot])
- /* GLM 5.3 cannot turn reasoning off. If the user switches to such a model
- while "off" is selected, lift it to a sane on-state instead of sending a
- level the model will ignore. */
+ /* GLM 5.3 cannot turn reasoning off and has no distinct "medium" (it collapses
+ onto High). If the user switches to such a model while "off" or "medium" is
+ selected, lift it to a level the model actually honors instead of leaving the
+ control on a value it no longer offers. */
useEffect(() => {
- if (modelForcesReasoning(model)) setReasoning((level) => level === "off" ? "high" : level)
+ if (modelForcesReasoning(model))
+ setReasoning((level) => (level === "off" || level === "medium" ? "high" : level))
}, [model])
// EFFECT #7
diff --git a/web/src/lib/reasoning.test.ts b/web/src/lib/reasoning.test.ts
new file mode 100644
index 00000000..65705b3f
--- /dev/null
+++ b/web/src/lib/reasoning.test.ts
@@ -0,0 +1,37 @@
+import { describe, expect, it } from "vitest"
+
+import { REASONING_EFFORT, modelForcesReasoning, reasoningLevelsFor } from "./reasoning"
+
+describe("modelForcesReasoning", () => {
+ it("is true for GLM 5.3 ids and false otherwise", () => {
+ expect(modelForcesReasoning("glm-5.3-flash-colibri")).toBe(true)
+ expect(modelForcesReasoning("glm-5.2-colibri")).toBe(false)
+ expect(modelForcesReasoning("qwen3.8-colibri")).toBe(false)
+ })
+})
+
+describe("reasoningLevelsFor", () => {
+ it("offers the full ladder (incl. off and medium) for non-forced models", () => {
+ expect(reasoningLevelsFor("glm-5.2-colibri")).toEqual([
+ "off",
+ "low",
+ "medium",
+ "high",
+ "max",
+ ])
+ })
+
+ it("drops off and the redundant medium for GLM 5.3 (template is Low/High/Max)", () => {
+ const levels = reasoningLevelsFor("glm-5.3-flash-colibri")
+ expect(levels).toEqual(["low", "high", "max"])
+ expect(levels).not.toContain("off")
+ expect(levels).not.toContain("medium")
+ })
+})
+
+describe("REASONING_EFFORT", () => {
+ it("maps max onto the engine's xhigh effort", () => {
+ expect(REASONING_EFFORT.max).toBe("xhigh")
+ expect(REASONING_EFFORT.low).toBe("low")
+ })
+})
diff --git a/web/src/lib/reasoning.ts b/web/src/lib/reasoning.ts
new file mode 100644
index 00000000..3c5bd386
--- /dev/null
+++ b/web/src/lib/reasoning.ts
@@ -0,0 +1,18 @@
+/* Reasoning depth for GLM. The engine renders enable_thinking + reasoning_effort;
+ these levels map onto the words GLM understands (Low/Medium/High/Max), and "off"
+ turns thinking off entirely. GLM 5.3 cannot disable reasoning, and its template
+ exposes only Low/High/Max (it renders "medium" as High). So for 5.3 both "off" and
+ the now-redundant "medium" are dropped -- mirroring the model's own constraint in
+ the control instead of offering a level it silently collapses onto High. */
+export type ReasoningLevel = "off" | "low" | "medium" | "high" | "max"
+
+export const REASONING_EFFORT: Record<Exclude<ReasoningLevel, "off">, string> = {
+ low: "low", medium: "medium", high: "high", max: "xhigh",
+}
+
+export const modelForcesReasoning = (model: string) => /5\.3/.test(model)
+
+export const reasoningLevelsFor = (model: string): ReasoningLevel[] =>
+ modelForcesReasoning(model)
+ ? ["low", "high", "max"]
+ : ["off", "low", "medium", "high", "max"]