Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(effort): 'minimal' ist keine Stufe, sondern ein Aus-Wert

purple4dfcf23974f7
diff --git a/src/lib/__tests__/effort.test.ts b/src/lib/__tests__/effort.test.ts
index d4b73689..8f85d9cc 100644
--- a/src/lib/__tests__/effort.test.ts
+++ b/src/lib/__tests__/effort.test.ts
@@ -35,6 +35,8 @@ import {
const GLM53 = ['low', 'medium', 'high', 'max']
const MOST = ['low', 'medium', 'high']
+// As the server declares it: the off values ride along in the upstream's own
+// list, and they are not rungs.
const QWEN38_27B = ['minimal', 'low', 'medium']
describe('clamping the wish onto the rungs a model really has', () => {
@@ -87,21 +89,42 @@ describe('no ladder means no change', () => {
})
})
-describe("'none' is the off switch and never a rung", () => {
- it('a server that sends none among the levels does not get it offered', () => {
+describe("'none' and 'minimal' are off values and never rungs", () => {
+ it('a server that sends them among the levels does not get them offered', () => {
expect(effortChoices(['none', 'low', 'high'])).toEqual(['low', 'high'])
+ expect(effortChoices(QWEN38_27B)).toEqual(['low', 'medium'])
+ expect(effortChoices(['none', 'minimal'])).toEqual([])
+ expect(hasEffortLadder(['none', 'minimal'])).toBe(false)
+ })
+
+ it('THE RULE: clamping never answers with an off value, whatever the ladder says', () => {
+ // A ladder of ['minimal','low','medium'] with a wish of 'max' has exactly
+ // one honest answer, and 'minimal' is not it: it would read as a rung in
+ // the composer while meaning "stop thinking" on the wire.
+ expect(clampEffort(QWEN38_27B, 'max')).toBe('medium')
+ expect(clampEffort(QWEN38_27B, 'low')).toBe('low')
+ // An off value as the WISH is not a rung either, so it falls through the
+ // unknown-wish path rather than being honoured as "think barely".
+ expect(clampEffort(QWEN38_27B, 'minimal')).toBe('medium')
+ expect(clampEffort(['minimal', 'medium'], 'low')).toBe('medium')
expect(clampEffort(['none', 'low'], 'max')).toBe('low')
})
+ it('and a ladder of nothing but off values is no ladder at all', () => {
+ expect(clampEffort(['none', 'minimal'], 'low')).toBe(DEFAULT_EFFORT)
+ expect(nextEffort(['minimal'], 'low')).toBe(DEFAULT_EFFORT)
+ })
+
it('nothing on this ladder ever answers none, on any wish', () => {
for (const wish of ['none', 'minimal', 'low', 'medium', 'high', 'max', 'ludicrous']) {
- expect(clampEffort(GLM53, wish)).not.toBe('none')
- expect(nextEffort(GLM53, wish)).not.toBe('none')
+ for (const ladder of [GLM53, MOST, QWEN38_27B, ['none', 'minimal', 'high']]) {
+ expect(['none', 'minimal']).not.toContain(clampEffort(ladder, wish))
+ expect(['none', 'minimal']).not.toContain(nextEffort(ladder, wish))
+ }
}
})
- it('and minimal is not offered either, the Think button already says off', () => {
- expect(effortChoices(QWEN38_27B)).toEqual(['low', 'medium'])
+ it('the four rungs are the whole ladder', () => {
expect(EFFORT_STEPS).toEqual(['low', 'medium', 'high', 'max'])
})
})
@@ -136,6 +159,7 @@ describe('labels and the type guard', () => {
it('knows a real rung from a stored typo', () => {
expect(isEffortLevel('high')).toBe(true)
expect(isEffortLevel('none')).toBe(false)
+ expect(isEffortLevel('minimal')).toBe(false)
expect(isEffortLevel('xhigh')).toBe(false)
})
})
diff --git a/src/lib/effort.ts b/src/lib/effort.ts
index 187ff967..3d491942 100644
--- a/src/lib/effort.ts
+++ b/src/lib/effort.ts
@@ -21,13 +21,21 @@
* in the customer's chat window and costs more tokens than sending nothing.
*/
-/** Ascending, cheapest first. The off switch is not part of it. */
-const RANK: Record<string, number> = { minimal: 0, low: 1, medium: 2, high: 3, max: 4 }
+/**
+ * Ascending, cheapest first, and it holds the rungs and NOTHING else.
+ *
+ * 'none' and 'minimal' are both ways of saying off, not quiet rungs at the
+ * bottom. They are filtered out of a declared ladder on the way in, so a server
+ * that lists them cannot make the composer offer an off switch that contradicts
+ * the Think button, and clamping can never answer with one either. That is the
+ * difference between "think a little" and "do not think", and on GLM 5.3 the
+ * second one costs MORE than sending no parameter at all.
+ */
+const RANK: Record<string, number> = { low: 0, medium: 1, high: 2, max: 3 }
/**
- * The rungs the composer offers. 'minimal' is not one of them: it is another
- * way of saying off, and two controls that both claim to turn thinking off is
- * how a user ends up disbelieving both.
+ * The rungs the composer offers, which is every rung there is: two controls
+ * that both claim to turn thinking off is how a user ends up disbelieving both.
*/
export const EFFORT_STEPS = ['low', 'medium', 'high', 'max'] as const