Every bot message gets an info button that opens its details: the provider and model behind it, tokens and cost, the job that ran it, each model used and every call in order. Each model call now records how it was made in token_usages.settings (generation settings sent, whose settings they were, pinned or automatic model, fallbacks), shown per model in the modal. Live replies now carry their token usage, from the job's push and the live relay alike, so it shows without a reload. Co-Authored-By: Claude Opus 5.5 <[email protected]>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import parseCallSettings from "./parse-call-settings";
|
|
|
|
describe("parseCallSettings", () => {
|
|
test("reads what was stored", () => {
|
|
expect(
|
|
parseCallSettings({
|
|
json: JSON.stringify({
|
|
model_source: "pinned",
|
|
settings_source: "bot",
|
|
params: { temperature: 0.3, reasoning_effort: "high", bad: { x: 1 } },
|
|
max_tokens: 800,
|
|
fell_back_from: ["2:a/b", 3],
|
|
}),
|
|
}),
|
|
).toEqual({
|
|
model_source: "pinned",
|
|
settings_source: "bot",
|
|
params: { temperature: 0.3, reasoning_effort: "high" },
|
|
max_tokens: 800,
|
|
fell_back_from: ["2:a/b"],
|
|
});
|
|
});
|
|
|
|
test("is null for an older call or a broken value", () => {
|
|
expect(parseCallSettings({ json: null })).toBeNull();
|
|
expect(parseCallSettings({ json: "{nope" })).toBeNull();
|
|
expect(parseCallSettings({ json: "3" })).toBeNull();
|
|
});
|
|
});
|