fix: the knowledge-context readout shows the full number (1024 tok, no k-rounding)
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
|||||||
GRAPH_CONTEXT_TOKENS_MAX,
|
GRAPH_CONTEXT_TOKENS_MAX,
|
||||||
GRAPH_CONTEXT_TOKENS_STEP,
|
GRAPH_CONTEXT_TOKENS_STEP,
|
||||||
} from "@/src/core";
|
} from "@/src/core";
|
||||||
import { formatTokens } from "@/components/usage-format";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The knowledge-context budget control (vision-context-injection.md) — the
|
* The knowledge-context budget control (vision-context-injection.md) — the
|
||||||
@@ -19,8 +18,8 @@ import { formatTokens } from "@/components/usage-format";
|
|||||||
* contribute to the session.
|
* contribute to the session.
|
||||||
*
|
*
|
||||||
* One quiet compact row sized to sit in the stats band beside the model +
|
* One quiet compact row sized to sit in the stats band beside the model +
|
||||||
* thinking pills: short slider, "tok" readout (abbreviated — "4.1k tok"
|
* thinking pills: short slider, "tok" readout, the FULL number (owner,
|
||||||
* stays on one line where "4.1k tokens" wrapped). 0 = off; absent settings
|
* 2026-09-15: no k-rounding — 1024 reads as 1024). 0 = off; absent settings
|
||||||
* show the DEFAULT (1024 — on). The value rides ChatSettings (the same
|
* show the DEFAULT (1024 — on). The value rides ChatSettings (the same
|
||||||
* lifted settings the model picker uses), so it persists pre-chat via the
|
* lifted settings the model picker uses), so it persists pre-chat via the
|
||||||
* same deferred PUT. Sessions never show this control — the injection is
|
* same deferred PUT. Sessions never show this control — the injection is
|
||||||
@@ -54,7 +53,7 @@ export function GraphContextControl({
|
|||||||
className="w-14 shrink-0 tabular-nums"
|
className="w-14 shrink-0 tabular-nums"
|
||||||
data-testid="graph-context-value"
|
data-testid="graph-context-value"
|
||||||
>
|
>
|
||||||
{value === 0 ? "off" : `${formatTokens(value)} tok`}
|
{value === 0 ? "off" : `${value} tok`}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -104,8 +104,9 @@ describe("DraftShell — the sessionless surface", () => {
|
|||||||
);
|
);
|
||||||
// The slider's default position: 1024 of 4096, step 128 (decided).
|
// The slider's default position: 1024 of 4096, step 128 (decided).
|
||||||
assert.ok(html.includes('min="0"') && html.includes('max="4096"') && html.includes('step="128"'));
|
assert.ok(html.includes('min="0"') && html.includes('max="4096"') && html.includes('step="128"'));
|
||||||
// The abbreviated readout (owner: "tokens" wrapped at >1k — "tok" stays one line).
|
// The readout: "tok" abbreviated, but the FULL number (owner, 2026-09-15:
|
||||||
assert.ok(html.includes("1k tok"), "the readout shows the default budget, not 0 — default is ON");
|
// no k-rounding — 1024 reads as 1024).
|
||||||
|
assert.ok(html.includes("1024 tok"), "the readout shows the default budget, not 0 — default is ON");
|
||||||
assert.ok(html.includes("Knowledge context"), "the control is labeled");
|
assert.ok(html.includes("Knowledge context"), "the control is labeled");
|
||||||
// Absent settings render the default — never 'off'.
|
// Absent settings render the default — never 'off'.
|
||||||
assert.ok(!html.includes(">off<"));
|
assert.ok(!html.includes(">off<"));
|
||||||
|
|||||||
Reference in New Issue
Block a user